Search the documentation

Type to search page titles, component names and descriptions.

    General

    ContextButton

    A two-line control that selects the workspace context.

    import { ContextButton } from 'faifo-design'

    ContextButton shows which workspace context is in effect (a company, a branch, a warehouse) on two lines, with an optional count, and opens the choice of another. The selection is owned by the server: choosing a context is a navigation or a submitted form, not client state.

    #When to use

    • Use it for the one context that scopes everything on the screen.
    • It is not a record card and not an ordinary command. A one-line command is a Button; a record summary is a ContentCard.

    #Examples

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

    #Context button

    Two-line workspace context with server-owned selection and an optional count; it is not a record card.

    Show codeHide code
    import { ContextButton, Inline } from 'faifo-design'
    
    export const Example = () => (
      <Inline
        items={[
          <ContextButton label="Personal inbox" description="Messaging account" count={5} pressed />,
          <ContextButton label="Store inbox" description="Official account" count={3} pressed={false} />,
          <ContextButton label="Unavailable workspace" description="Access required" disabled />,
        ]}
      />
    )

    #API

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

    #ContextButtonComponent

    Selects a workspace context with a second line, rather than an ordinary one-line command.

    PropertyDescriptionTypeDefault
    id–string–
    labelrequired–string–
    description–string–
    leading–JSXChild–
    count–number–
    pressed–boolean–
    disabled–boolean–
    name–string–
    value–string–

    #Types

    #ContextButtonProps

    The properties of ContextButton, 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.

    • context-button
    • context-button-leading
    • context-button-copy