Search the documentation

Type to search page titles, component names and descriptions.

    Feedback

    ModalSheet

    Record and picker content over the page.

    import { ModalSheet } from 'faifo-design'

    ModalSheet presents a record, a picker or a short task over the current page, as a centred dialog or a sheet at the end edge. It has a title, a scrolling body and a footer for actions.

    #When to use

    • Use it to create or edit a record without leaving the list the reader came from.
    • Use presentation="dialog" for small forms and sheet for content that reads like a panel.
    • A question before a destructive action is a ConfirmDialog.

    #Notes

    attachClientModalInteractions manages the focus lifetime of a sheet that a client island opens and closes.

    #Examples

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

    #Modal sheet

    Shown embedded here; the production mode occupies the viewport.

    Close modal
    Show codeHide code
    import { ActionGroup, Button, LinkButton, ModalSheet, Notice, Stack } from 'faifo-design'
    
    export const Example = () => (
      <ModalSheet
        id="release-drift-modal"
        mode="embedded"
        title="Resolve release drift"
        closeHref="#modal-sheet"
        closeLabel="Close modal"
        body={
          <Stack
            items={[
              <Notice
                title="Two tenants are behind"
                message="Migration runs separately for each database and preserves failed tenants for retry."
                tone="warning"
              />,
              <ActionGroup
                actions={[
                  <Button label="Start migration" variant="primary" />,
                  <LinkButton label="Review plan" href="#data-table" variant="tertiary" />,
                ]}
              />,
            ]}
          />
        }
      />
    )

    #Viewport-width modal workspace

    Explicit spatial dialog with several working columns; title/footer stay around the body.

    Close workspace
    Show codeHide code
    import { Grid, ModalSheet, Section, Text } from 'faifo-design'
    
    export const Example = () => (
      <ModalSheet
        id="workspace-modal-example"
        mode="embedded"
        presentation="dialog"
        size="workspace"
        height="fixed"
        title="Create order workspace"
        closeHref="#workspace-modal"
        closeLabel="Close workspace"
        body={
          <Grid
            columns={3}
            items={[
              <Section title="Products" body={<Text>Searchable product list</Text>} />,
              <Section title="Cart & payment" body={<Text>Quantities, fee and total</Text>} />,
              <Section title="Delivery" body={<Text>Recipient, carrier and parcel options</Text>} />,
            ]}
          />
        }
      />
    )

    #API

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

    #attachClientModalInteractionsFunction

    Focus lifetime for a server-rendered client ModalSheet. The application owns opening/closing and calls the disposer before replacing the active layer. Native close buttons retain the application's event handler; no navigation is invented for a client modal. Embedded sheets and native dialog owners are ignored.

    function attachClientModalInteractions(root?: Document | HTMLElement | undefined) => (): void
    ParameterType
    rootDocument | HTMLElement
    Returns() => void

    #ModalSheetComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    titlerequired–string–
    bodyrequired–JSXChild–
    closeHrefRequired for overlay: a route modal closes by navigating. Ignored in client mode.string'#'
    closeLabelrequired–string–
    description–string | null–
    statusWhat state the thing in this dialog is in, beside its title — a badge, not a sentence. It belongs to the heading, so it stays put when the body scrolls and is read out with the title rather than after it.JSXChild–
    actions–JSXChild–
    presentation–'sheet' | 'dialog''sheet'
    sizeWorkspace dialogs use the available viewport width, with the same overlay margin.'small' | 'default' | 'large' | 'workspace''default'
    heightcontent (default) lets a dialog grow with its body up to the viewport cap. fixed holds the dialog at that cap so switching between tabs of different heights does not resize it; the body scrolls inside while the head stays put.'content' | 'fixed'–
    fixedHeightOverrides fixed's height (default: the viewport cap, 100dvh minus a margin — tall on most screens). A CSS length or calc()/min() expression, for a dialog whose own content is shorter than the viewport and would otherwise sit in a mostly empty frame. Stored in a CSS custom property so responsive fullscreen rules still take precedence. Ignored when height is not fixed.string–
    modeoverlay is URL-owned: its close controls are links the route runtime follows. client belongs to a modal island that opens and closes it in the browser: close controls are buttons, and it carries no route-modal marker, so no navigation layer ever treats closing it as a page change.'overlay' | 'embedded' | 'client''overlay'
    dialogSemanticsA native dialog ancestor can own the accessible dialog role and name.'self' | 'parent'–
    unsavedPrompt–string | null–

    #Hooks

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

    • modal-layer
    • modal-backdrop
    • modal-sheet
    • modal-head
    • modal-heading
    • modal-title-row
    • modal-title
    • modal-description
    • modal-close
    • modal-body
    • modal-actions