Talisman LogoTalisman Logo Design System
Browse documentation
Components

Radio filter

A single-choice filter shown as compact badges or as tiles, with optional counts and semantic colors for statuses.

Stableimport { RadioFilter } from "@repo/ui/filters";Source
size
<RadioFilter allowDeselect label="Status da tarefa" size="badge" />

When to use

  • To filter a list or a table by one value, such as the status of a task.
  • When the options are few and the user should see all of them at once.
  • When each option can show a count.

When not to use

  • A choice sent with a form. Use Radio group.
  • Options with a title and a description. Use Radio card.
  • Many options or a searchable list. Use Select.
  • Filtering by several values at once. Use a multi-select filter from the same package.

Sizes

badge is a compact row of chips. card and cardCompact are tiles for the main filter of a page.

Badge

Card

Compact card

Size Use for
badge Status filters above a list. Scrolls with optionsClassName.
card The main filter of a page. 128px square tiles.
cardCompact Dense panels. 76px square tiles.

Variants

Semantic variants apply to badge options and color the badge while it is selected. A selected semantic badge also shows a check, so the status does not depend on color alone. Without variant, the selected badge uses the standard brand light fill and no check.

Variant Use for
neutral Neutral options such as “Pendentes”.
info Active or informational states.
success Completed states.
warning Skipped or paused states.
error Failed states.

States

With a visible label

Disabled

Disable the whole group with disabled, or one option with disabled in its object.

Content

  • Put “Todas” first, and use allowDeselect={false} when one option must always stay selected.
  • With allowDeselect (the default), selecting the active option again clears the filter and calls onValueChange(null).
  • Use endContent for counts. It is visual only: do not put essential information there.
  • Keep labels to one or two words: “Com falha”, “Concluídas”.

Accessibility

  • Built on Radix Radio Group. The group is role="radiogroup" and each option has an sr-only role="radio" input inside a Label, so the whole chip or tile is clickable.
  • Tab enters the group at the selected option. Arrow keys move focus and selection, and Space selects.
  • Pass label or ariaLabel. With label, the group is named by it through aria-labelledby. Without it, ariaLabel is the name.
  • In badge size the focus ring is drawn around the chip when the radio has keyboard focus.
  • endContent is aria-hidden. Counts are not read, so repeat what matters in label.

Code

import { RadioFilter } from "@repo/ui/filters";

<RadioFilter
  allowDeselect={false}
  ariaLabel="Filtrar tarefas por status"
  onValueChange={setStatus}
  options={[
    { label: "Todas", value: "todas" },
    { label: "Concluídas", value: "concluidas", variant: "success" },
    { label: "Com falha", value: "falha", variant: "error" },
  ]}
  value={status}
/>;

Props

RadioFilter
PropTypeDefaultDescription
allowDeselectbooleantrueLets the user clear the filter by selecting the active option again
ariaLabelstring—Accessible name of the group when no `label` is shown
disabledbooleanfalseDisables the whole group
labelstring—Visible label above the options
onValueChange(value: string | null) => void—Called with the new value, or `null` when the user clears the filter
optionsRadioFilterOption[]—Options with `value` and `label`, plus optional `icon`, `variant`, `endContent` and `disabled`
size"badge" | "card" | "cardCompact"badgePresentation of the options
valuestring—Controlled value of the selected option
RadioFilterOption
PropTypeDefaultDescription
valuestring—Value of the option. Required.
labelstring—Visible and accessible name of the option. Required.
variant"neutral" | "info" | "success" | "warning" | "error"—Color of the selected badge, with a check. Only for `size="badge"`.
iconElementType—Icon before the label.
endContentReactNode—Visual-only content after the label, such as a count.
disabledbooleanfalseDisables this option.

Other props: labelIcon (ElementType) adds an icon before the visible label, and className and optionsClassName adjust layout.

Known issues

Issue Effect
The focus ring (has-[:focus-visible]) exists only for badge size. card and cardCompact options without an icon, and every compact option, have none. Keyboard users cannot see which tile has focus.
A badge option without variant has no disabled style, only cursor-pointer. A disabled option looks enabled. Only options with a variant get opacity-50 and a muted border.
Disabled semantic badges use opacity-50. Translucent state, against the no-transparency rule.
The badge hover uses hover:bg-disabled, the disabled fill token. The hover color is the same as the one that means “unavailable”.
size="card" with an icon renders a Tile with its own styles and ignores endContent. Counts do not show on large icon tiles.
Edit this page on GitHub