Search the documentation

Type to search page titles, component names and descriptions.

    Layout

    Cards and metrics

    Independently actionable objects, board cards and headline numbers.

    import { CardGrid, ContentCard, KanbanCard, KanbanGrid, Metric } from 'faifo-design'

    ContentCard summarizes one record that can be acted on by itself; KanbanCard is its compact form for board columns. CardGrid and KanbanGrid lay collections of them out by available width. Metric shows one headline number with its label and change.

    #When to use

    • Use a card when the object has its own identity, link and actions. A group of fields is a Section, not a card.
    • Use CardGrid when the count per row should follow the width of the container.
    • Use Metric for an exact figure. Long amounts wrap inside the card instead of being clipped.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Content card

    A composable record summary with valid nested actions.

    Deployment

    Commerce

    General retail operations

    Stable
    Operational components and workflow recipes

    Deployment

    Cosmetic

    Care and marketplace workflows

    Review
    Operational components and workflow recipes

    Deployment

    Hospitality

    Property and OTA operations

    Pilot
    Operational components and workflow recipes
    Show codeHide code
    import { Badge, CardGrid, ContentCard } from 'faifo-design'
    
    export const Example = () => (
      <CardGrid
        items={[
          { id: 'commerce', name: 'Commerce', summary: 'General retail operations', state: 'Stable' },
          {
            id: 'cosmetic',
            name: 'Cosmetic',
            summary: 'Care and marketplace workflows',
            state: 'Review',
          },
          {
            id: 'hospitality',
            name: 'Hospitality',
            summary: 'Property and OTA operations',
            state: 'Pilot',
          },
        ]}
        id={(item) => item.id}
        card={(item) => (
          <ContentCard
            eyebrow="Deployment"
            title={item.name}
            summary={item.summary}
            body="Operational components and workflow recipes"
            status={<Badge label={item.state} tone={item.state === 'Stable' ? 'positive' : 'warning'} />}
            href="#content-card"
            selected={item.id === 'cosmetic'}
            tone={item.id === 'hospitality' ? 'subtle' : 'default'}
          />
        )}
      />
    )

    #Kanban cards

    Compact record cards keep board metadata and actions consistent across workflows.

    Show codeHide code
    import { Badge, KanbanCard, KanbanGrid } from 'faifo-design'
    
    type OrderRow = {
      id: string
      customer: string
      total: string
      state: 'Ready' | 'Review' | 'Blocked'
    }
    
    const orders: OrderRow[] = [
      { id: 'SO-1042', customer: 'Công ty Ánh Dương', total: '18.450.000 ₫', state: 'Ready' },
      { id: 'SO-1041', customer: 'Khách sạn Mùa Hạ', total: '6.800.000 ₫', state: 'Review' },
      { id: 'SO-1039', customer: 'Nguyễn Minh Châu', total: '2.150.000 ₫', state: 'Blocked' },
    ]
    
    const toneOf = (state: OrderRow['state']) =>
      state === 'Ready' ? ('positive' as const) : state === 'Review' ? ('warning' as const) : ('danger' as const)
    
    export const Example = () => (
      <KanbanGrid
        rows={orders}
        id={(row) => row.id}
        card={(row) => (
          <KanbanCard
            id={row.id}
            title={`${row.id} · ${row.customer}`}
            href="#kanban-card"
            meta={<Badge label={row.state} tone={toneOf(row.state)} />}
            note={row.total}
          />
        )}
      />
    )

    #Long exact metric value

    Adaptive card tracks and the metric text column wrap exact amounts instead of clipping them.

    Posted revenue with a long translated label

    9.007.199.254.740.993 ₫

    Show codeHide code
    import { CardGrid, Icon, Metric } from 'faifo-design'
    
    export const Example = () => (
      <CardGrid
        minimum="wide"
        items={[{ id: 'long', value: '9.007.199.254.740.993 ₫' }]}
        id={(row) => row.id}
        card={(row) => (
          <Metric
            label="Posted revenue with a long translated label"
            value={row.value}
            icon={<Icon name="info" />}
          />
        )}
      />
    )

    #Contract

    #Exact values in adaptive metric cards

    Use CardGrid with minimum="wide" for long currency metrics. Metric owns a bounded text column and wraps long labels and exact values; consumers do not truncate financial totals or override metric descendants. Specimen: metric-exact-long-value; focused producer checks and mutations: design/account/producer-contracts.test.mjs and tools/design/verify-account-producer-mutations.mjs.

    A metric that opens what it counts (a queue, a filtered collection) passes href: the whole card is that link, focusable and named by its label and value. Do not add a separate "View list" button under the number. Inside a titled Surface a group of metrics is plain figures without href, so one card never holds several competing links.

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #CardGridComponent

    An adaptive card collection; unlike Grid, column count follows available width.

    PropertyDescriptionTypeDefault
    itemsrequired–readonly T[]–
    idrequired–(item: T) => unknown–
    cardrequired–(item: T) => TemplateResult–
    minimum–'compact' | 'default' | 'wide'–

    #ContentCardComponent

    PropertyDescriptionTypeDefault
    titlerequired–string–
    eyebrow–string | null–
    summary–string | null–
    leading–JSXChild–
    media–JSXChild–
    mediaPlacementtop (default) runs media edge to edge above the card. start keeps a square picture beside all of the card's content, for catalogue items whose image identifies them; the meta row then holds the item's key figure (a price) at the content's end.'top' | 'start'–
    status–JSXChild–
    body–JSXChild–
    meta–JSXChild–
    actions–JSXChild–
    href–string | null–
    selected–boolean–
    tone–'default' | 'subtle' | 'raised''default'
    padding–'compact' | 'default''default'

    #KanbanCardComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    titlerequired–string–
    href–string | null–
    media–JSXChild–
    meta–JSXChild–
    note–string | null–
    actions–JSXChild–
    selected–boolean–
    draggableNative drag source; the product runtime validates and handles the move.boolean–

    #KanbanGridComponent

    PropertyDescriptionTypeDefault
    rowsrequired–readonly T[]–
    idrequired–(row: T) => unknown–
    cardrequired–(row: T) => TemplateResult–
    dropTargetA lane remains a usable drop target even when rows is empty.string–
    dropLabel–string–
    emptyLabel–string–

    #MetricComponent

    PropertyDescriptionTypeDefault
    labelrequired–string–
    valuerequired–string | number–
    detail–string | null–
    tone–Tone'neutral'
    iconA glyph naming the quantity, in a tile beside it. Decorative: the label is the name of the number, so this is hidden from assistive technology.JSXChild–
    href–string | null–
    change–MetricChange | null–

    #Types

    #CardGridProps

    The properties of CardGrid, listed above.

    #ContentCardProps

    The properties of ContentCard, listed above.

    #KanbanCardProps

    The properties of KanbanCard, listed above.

    #KanbanGridProps

    The properties of KanbanGrid, listed above.

    #MetricChange

    One number, with the context that makes it mean something. tone colours a dot beside the label and nothing else. The number itself stays in the page's ink: a KPI row is read by comparing figures, and four differently coloured figures are compared by colour instead. The dot is drawn only when a tone is passed, so a metric that has no state to report does not grow a grey bullet that means nothing. href makes the whole card the link rather than the label, because the card is what the pointer is already over. There is nothing else inside a metric to click, which is exactly why ContentCard does the opposite. change compares the figure with an earlier period. The label carries the signed amount and the period in words ("+12.4% vs previous 7 days"), the arrow repeats the direction, and the tone says whether that direction is good: a cost that went up is danger although its arrow points up. Colour is never the only cue, and the figure itself stays in the page's ink.

    PropertyDescriptionTypeDefault
    labelrequired–string–
    directionrequired–'up' | 'down' | 'flat'–
    tone–'positive' | 'danger' | 'neutral'–