Search the documentation

Type to search page titles, component names and descriptions.

    Layout

    Dock

    Non-modal panels for a task that runs beside the page.

    import { Dock, DockRegion } from 'faifo-design'

    A Dock holds a task that continues while the reader works on the page under it: a phone call, a chat conversation. It takes no focus and does not block the page. DockRegion is the page's one place for docks, at the bottom end of the viewport; it shows only while it holds one and reserves scroll room so the dock never covers the last row.

    #When to use

    • Use it for a parallel task with its own lifetime.
    • It is not a dialog. A question uses ConfirmDialog; record content uses ModalSheet or Peek.

    #Examples

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

    #Dock

    Non-modal panels for tasks beside the page, such as a call and a chat conversation, in the DockRegion at the bottom end of the viewport (shown embedded). While a dock is open, toasts move to the top end and the page keeps room for a collapsed dock. Collapsed, the actions stay.

    Incoming call · Gifts and corporate

    Sam Lee

    On a call · Line 0901 234 501

    Alex Morgan

    04:12Recording
    Phone
    090 661 0423
    Show codeHide code
    import { ActionGroup, Badge, Button, DescriptionList, Dock, DockRegion, Icon, IconButton, Link, Text } from 'faifo-design'
    
    export const Example = () => (
      <DockRegion
        placement="embedded"
        docks={[
          <Dock
            id="ringing-dock"
            tone="attention"
            collapsed
            eyebrow="Incoming call · Gifts and corporate"
            title="Sam Lee"
            toggle={{ collapseLabel: 'Hide matching records', expandLabel: 'Show matching records' }}
            body={<Text>Two open records match this number.</Text>}
            actions={
              <ActionGroup
                actions={[
                  <Button label="Answer" variant="primary" icon="phone" />,
                  <Button label="Decline" variant="secondary" icon="phone-off" />,
                ]}
              />
            }
          />,
          <Dock
            id="call-dock"
            eyebrow="On a call · Line 0901 234 501"
            title="Alex Morgan"
            status={[<Text>04:12</Text>, <Badge label="Recording" tone="danger" />]}
            toggle={{ collapseLabel: 'Collapse call', expandLabel: 'Expand call' }}
            body={
              <DescriptionList
                columns="auto"
                items={[
                  { id: 'phone', label: 'Phone', value: '090 661 0423' },
                  {
                    id: 'record',
                    label: 'Open record',
                    value: <Link href="#dock" label="CS-3472 · Late delivery" />,
                  },
                ]}
              />
            }
            actions={
              <ActionGroup
                actions={[
                  <IconButton label="Mute" icon={<Icon name="mic-off" />} pressed={false} />,
                  <IconButton label="Hold" icon={<Icon name="pause" />} pressed={false} />,
                  <Button label="End call" variant="destructive" icon="phone-off" />,
                ]}
              />
            }
          />,
        ]}
      />
    )

    #Contract

    #Docks for tasks beside the page

    Dock is a non-modal panel for a task that runs while the reader keeps working on the page: a phone call, and later a chat conversation. DockRegion is the page's one place for docks, at the bottom end of the viewport. Several channels share the region; each owns its own Dock. The newest dock is last, at the end edge, and older ones line up before it.

    <DockRegion
      docks={[
        <Dock
          id="call-dock"
          eyebrow="On a call · Line 0901 234 501"   // what the panel is doing: announced on change
          title="Alex Morgan"
          status={[<Text>04:12</Text>, <Badge label="Recording" tone="danger" />]} // not announced
          toggle={{ collapseLabel: 'Collapse call', expandLabel: 'Expand call' }}
          collapsed={collapsed}                    // the owner flips it when `call-dock-toggle` is pressed
          body={<CallNotes />}
          actions={<ActionGroup actions={[mute, hold, endCall]} />}
        />,
      ]}
    />
    • Not a dialog. A dock has no backdrop, takes no focus and does not make the page inert. It is a labelled region (section named by its title). The heading (eyebrow and title) is a polite live region, so a state change such as an answered call is announced. The status beside it, such as a timer, is outside that region and is not announced.
    • Collapse. With a body and toggle, the head gets a collapse control, <id>-toggle, which names the body with aria-controls. A collapsed dock keeps its head and actions, so a call can still be ended. Without a body there is nothing to collapse.
    • Attention. tone="attention" puts a second ring around a dock that waits for the reader, such as a ringing call. The eyebrow says why, so colour is not the only cue.
    • Layers and the page. A call runs across dialogs: the region sits on --faifo-layer-dock, over the page, its menus and its dialogs, and under toasts. A client dialog does not make the region inert, and every dialog keeps --faifo-dock-reserve free at the bottom so its own actions stay clear of a collapsed dock. While the region holds a dock, app-main keeps the same scroll room under its last row. Toasts move to the top end, under the topbar, whatever the size or number of docks. The region shows only while it holds a dock, so an island can keep an empty region in the page. A dialog's focus loop stays inside the dialog: a keyboard user reaches the dock once it closes.
    • Phone. Below 48rem the region spans the bottom edge as a sheet, capped at 70% of the viewport, with docks one above the other. The owner keeps one of them expanded at a time.
    • Owner. Calls, timers, media and network belong to the product's island. The dock only renders state. Render one DockRegion per page, inside the design system scope. A product that must keep a call through navigation keeps the region outside the content it replaces, using fragment navigation.

    #API

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

    #DockComponent

    A non-modal panel for a task that runs beside the page, such as a phone call or a chat conversation: the reader keeps working on the page under it. It is not a dialog; it takes no focus and does not make the page inert. In a DockRegion it floats at the bottom end of the viewport; anywhere else it is laid out in place (documentation, catalogue specimens).

    PropertyDescriptionTypeDefault
    idrequiredThe stem of the title, body and toggle ids.string–
    titlerequired–string–
    eyebrowWhat the panel is doing now (an incoming call, a call in progress), above the title.string | null–
    statusLive facts beside the title: a timer, a recording badge. Not announced.JSXChild–
    bodyThe panel's working content, hidden while it is collapsed.JSXChild–
    actionsCommands for this state, at most one primary. They stay in view while the panel is collapsed.JSXChild–
    collapsedShows the head and the actions only, so the page under the panel can be used.boolean–
    toggleShows the collapse control (<id>-toggle, which names the body with aria-controls). The owner flips collapsed when it is pressed. Omit for a panel without a body.{ collapseLabel: string; expandLabel: string } | null–
    toolsOther head tools before the toggle, such as closing an idle panel. Small icon actions.JSXChild–
    toneattention frames a panel that waits for the reader, such as a ringing call.'default' | 'attention''default'

    #DockRegionComponent

    The page's one place for docks, at the bottom end of the viewport, above the page and under menus, popovers and dialogs. It shows only while it holds a Dock. While it does, the page keeps scroll room under its last row for a collapsed dock and toasts move to the top end, so neither covers the other. Render it once per page, inside the design system scope; an island may keep it empty until a dock opens.

    PropertyDescriptionTypeDefault
    docksThe open docks, the newest last: it sits at the end edge and the others line up before it. Several channels share the region (a call beside chat conversations); each owns its Dock.JSXChild–
    placementfixed (default) floats at the bottom end of the viewport. embedded stays in place for specimens.'fixed' | 'embedded''fixed'

    #Types

    #DockProps

    The properties of Dock, listed above.

    #DockRegionProps

    The properties of DockRegion, listed above.

    #Hooks

    The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.

    • dock-region
    • dock
    • dock-head
    • dock-heading
    • dock-eyebrow
    • dock-title
    • dock-status
    • dock-tools
    • dock-body
    • dock-foot
    • dock-actions