Search the documentation

Type to search page titles, component names and descriptions.

    Data Entry

    Filters and saved views

    URL-driven search, filter, sort and view settings.

    import { AppliedFilters, FilterBar, SavedViews, SearchBar, SortMenu, ViewSettings } from 'faifo-design'

    SearchBar, FilterBar, AppliedFilters, SortMenu, SavedViews and ViewSettings are the controls of a collection. Each one links to a canonical URL and preserves the query state it does not own; withQueryState builds those URLs.

    #When to use

    • Use them when a collection is rendered on the server and its state lives in the URL.
    • The application owns persistence and permission for saved views; the components carry version tokens.

    #Examples

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

    #Search, filter and sort

    Every control has a canonical URL and preserves unrelated query state.

    OpenMy records
    Sort
    Show codeHide code
    import { AppliedFilters, FilterBar, LinkButton, SearchBar, Select, SortMenu, Stack } from 'faifo-design'
    
    export const Example = () => (
      <Stack
        items={[
          <SearchBar action="/orders" value="An Việt" hidden={{ state: 'open' }} />,
          <FilterBar
            filters={[
              <LinkButton href="/orders?state=open" label="Open" size="compact" />,
              <LinkButton href="/orders?owner=me" label="My records" size="compact" />,
              <SortMenu
                id="sort-orders"
                choices={[
                  {
                    id: 'updated',
                    label: 'Recently updated',
                    href: '/orders?sort=updated',
                    active: true,
                  },
                  { id: 'value', label: 'Highest value', href: '/orders?sort=value' },
                ]}
              />,
            ]}
          />,
          <FilterBar
            label="Report choices"
            action="/reports/sales"
            hidden={{ company: 'north' }}
            submitLabel="Apply"
            filters={[
              <Select
                id="specimen-report-period"
                name="period"
                label="Period"
                labelHidden
                value="2026"
                options={[
                  { value: '2026', label: 'Year 2026' },
                  { value: '2026-Q4', label: 'Q4 2026' },
                ]}
              />,
              <Select
                id="specimen-report-group"
                name="groupBy"
                label="Group by"
                labelHidden
                value="month"
                options={[
                  { value: 'month', label: 'By month' },
                  { value: 'customer', label: 'By customer' },
                ]}
              />,
            ]}
          />,
          <AppliedFilters
            filters={[
              { id: 'state', label: 'State', value: 'Open', removeHref: '/orders?q=An+Việt' },
              { id: 'owner', label: 'Owner', value: 'Me', removeHref: '/orders?state=open' },
            ]}
            clearHref="/orders"
          />,
        ]}
      />
    )

    #Saved views and settings

    The renderer carries version tokens while the application owns persistence and permission.

    View settings
    Show codeHide code
    import { SavedViews, Stack, ViewSettings } from 'faifo-design'
    
    export const Example = () => (
      <Stack
        items={[
          <SavedViews
            views={[
              {
                id: 'all',
                label: 'All orders',
                href: '/orders',
                active: true,
                description: '148 records',
              },
              {
                id: 'review',
                label: 'Needs review',
                href: '/orders?view=review',
                description: '7 records',
              },
            ]}
          />,
          <ViewSettings
            id="order-view"
            action="/orders/views"
            version="7"
            settings={[
              { id: 'customer', label: 'Customer', visible: true, disabled: true },
              { id: 'total', label: 'Total', visible: true },
              { id: 'owner', label: 'Owner', visible: false },
            ]}
          />,
        ]}
      />
    )

    #API

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

    #AppliedFiltersComponent

    PropertyDescriptionTypeDefault
    label–string'Applied filters'
    filtersrequired–readonly AppliedFilter[]–
    clearHref–string–
    clearLabel–string'Clear all'

    #FilterBarComponent

    PropertyDescriptionTypeDefault
    label–string'Filters'
    filtersrequired–readonly JSXChild[]–
    actionMakes the bar a GET form to this address with no submit step: the runtime applies a choice at once, as RecordForm({ applyOnInput: true }) does. Without it the bar only groups controls.string–
    hiddenQuery values the form carries along, such as the company scope.Record<string, string>–
    submitLabelThe accessible name of the hidden default button, which still applies on Enter.string'Apply'

    #SavedViewsComponent

    PropertyDescriptionTypeDefault
    label–string'Saved views'
    viewsrequired–readonly SavedView[]–
    PropertyDescriptionTypeDefault
    actionrequired–string–
    value–string | null''
    name–string'q'
    id–string'resource-search'
    label–string'Search'
    placeholder–string–
    submitLabel–string'Search'
    hidden–Readonly<Record<string, string>>–

    #SortMenuComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    label–string'Sort'
    choicesrequired–readonly SortChoice[]–

    #ViewSettingsComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    label–string'View settings'
    actionrequired–string–
    settingsrequired–readonly ViewSetting[]–
    version–string–
    submitLabel–string'Save view'

    #withQueryStateFunction

    function withQueryState(href: string, changes: Readonly<Record<string, string | number | boolean | null | undefined>>): string
    ParameterType
    hrefrequiredstring
    changesrequiredReadonly<Record<string, string | number | boolean | null | undefined>>
    Returnsstring

    #Types

    #AppliedFilter

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequired–string–
    valuerequired–string–
    removeHrefrequired–string–

    #SavedView

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequired–string–
    hrefrequired–string–
    active–boolean–
    description–string–

    #SearchBarProps

    The properties of SearchBar, listed above.

    #SortChoice

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequired–string–
    hrefrequired–string–
    active–boolean–

    #ViewSetting

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequired–string–
    visiblerequired–boolean–
    disabled–boolean–

    #Hooks

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

    • search-bar
    • filter-bar
    • applied-filters
    • applied-filter
    • saved-views
    • saved-view
    • view-settings
    • view-settings-options