Skip to content
ghostui

Choice matrix

Collect one or several answers for each row without losing the row context.

Preview

Choice
Hard
Neutral
Easy
Navigation
Search
Sharing

Installation

Install

Basic usage

Each row owns an independent answer. Use selection="radio" for one answer per row or selection="checkbox" when a row can contain several answers. Put the visible field label in Field, and pass stable id values for rows and columns.

Structures

Examples

Radio rows

Use one answer per row for a rating or comparison question.

Choice
Hard
Neutral
Easy
Navigation
Search
Sharing

Checkbox rows

Use several answers per row when more than one column can apply.

Choice
Hard
Neutral
Easy
Navigation
Search
Sharing

Empty, incomplete, and narrow rows

Pass an empty rows array for the empty state. required marks each row that has no answer, while invalid communicates an external validation result. The matrix keeps its minimum column context and scrolls horizontally when a narrow host cannot fit the supplied columns. The examples submit required radio and checkbox rows. Checkbox form data keeps all selected values in each row. Disabled rows or columns remain visible and cannot change.

Choice
Hard
Neutral
Easy
Navigation
Search
Sharing
Choice
Hard
Neutral
Easy
Navigation
Search
Sharing
Choice
Hard
Neutral
Easy
Archived feature with a long name that stays visible while scrolling
Choice
Hard
Neutral
Easy
No choices available.

API reference

The component composes the canonical RadioGroup, CheckboxGroup, and their controls. Radio rows submit one value per row. Checkbox rows submit the selected column values for each row. Keyboard focus stays on the native Base UI control and the row and column names remain available to assistive technology.

Native div attributes and a div ref are supported on the root. Labels and business validation belong to the caller.