FilterChip

A filter as one pill, “Status is 2xx”: property, operator and value, each opening a menu.

View source
Status
import { FilterChip } from "@logicplanes/kaeso-ui";

Props

  • defaultValuesOpen
    boolean

    Open the value menu when the chip appears: a filter just added asks for its value at once.

  • freeText
    ((text: string) => ReactNode)

    Lets what someone types in the search field be the value, for a filter no list can hold, such as text an error message contains: the label of the item that takes it. Enter takes it too.

  • groups
    CommandListGroup[]

    Choices as ready-made searchable list groups, in place of values: rows with marks and details and headings with logos, such as useModelGroups or useProviderGroups build.

  • multiple
    boolean

    Several values may be chosen.

  • onOperatorChange
    ((operator: string) => void)

    Called with the chosen comparison.

  • onRemove
    (() => void)

    Called when the filter is removed.

  • onSelectedChange
    ((selected: string[]) => void)

    Called with the chosen values.

  • onValuesOpenChange
    ((open: boolean) => void)

    Called when the value menu opens or closes, so a filter just added can go away when it closes without a value.

  • operator
    string

    "is", "is not", "is any of"

  • operators
    string[]

    The comparisons people can choose, such as “is” and “is not”.

  • property
    ReactNode

    "Status"

  • propertyIcon
    IconSvgElement

    The icon of the property the filter applies to.

  • searchable
    boolean

    Gives the value menu a search field however few choices it has.

  • selected
    string[] = []

    The chosen values.

  • value
    ReactNode

    The value, as shown: "2xx", or "2 models".

  • values
    FilterChipChoice[]

    Choices for the value menu: past 8 it gets a search field, past 50 it opens a fast searchable list grouped by each choice's group, such as models by provider.

  • width
    "md" | "sm" | "lg"

    How wide the searchable list opens: sm for providers, lg for models with their details.