FormsPopoverOption
Searchastronomic.dev# PopoverOption For one choice in a Popover's panel: a real checkbox or radio, as a full-width row. Static: no JavaScript. ## Usage ```astro import PopoverOption from "@astronomic-dev/ui/components/PopoverOption.astro"; ``` ## Examples ### Checkbox and radio rows A checkbox shows its box; a radio shows a fill and a tick when picked. Here outside a panel, so all the states show at once. ```astro --- import PopoverOption from "@astronomic-dev/ui/components/PopoverOption.astro"; --- <div class="grid max-w-56"> <PopoverOption type="checkbox" name="amenity" value="garage" checked>Garage</PopoverOption> <PopoverOption type="checkbox" name="amenity" value="yard">Yard</PopoverOption> <PopoverOption type="radio" name="status" value="active" checked>Active</PopoverOption> <PopoverOption type="radio" name="status" value="pending">Pending</PopoverOption> <PopoverOption type="radio" name="status" value="sold" disabled>Sold</PopoverOption> </div> ``` ## Props ### PopoverOption | Prop | Type | Default | Description | | --- | --- | --- | --- | | `type` | `"checkbox" \| "radio"` | None | Required. A checkbox for several choices, a radio for one. | | `name` | `string` | None | Required. The form field's name. | | `value` | `string` | None | Required. The value it submits. In a range, a number, or "" for no pick. | | `class` | `string` | None | More classes for the row (the label), not the input, merged with cn(), so yours win on conflicts. | | Slot | Description | | --- | --- | | `default` | The option's words. A summary reads them for the trigger. | Any other attribute goes on the <input>: checked, disabled, data-*. ## Accessibility - A real checkbox or radio inside its label, so the whole row is the hit area and the words are its name. A picked state is never color alone: a tick shows it. Rows are at least 44px on a touch screen.
PopoverOption
FreeFor one choice in a Popover's panel: a real checkbox or radio, as a full-width row.
- File
- PopoverOption.astro
- Group
- Forms
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Checkbox and radio rows
A checkbox shows its box; a radio shows a fill and a tick when picked. Here outside a panel, so all the states show at once.
Force statemain.astro
examples/popoveroption/main.astro
---
import PopoverOption from "@astronomic-dev/ui/components/PopoverOption.astro";
---
<div class="grid max-w-56">
<PopoverOption type="checkbox" name="amenity" value="garage" checked>Garage</PopoverOption>
<PopoverOption type="checkbox" name="amenity" value="yard">Yard</PopoverOption>
<PopoverOption type="radio" name="status" value="active" checked>Active</PopoverOption>
<PopoverOption type="radio" name="status" value="pending">Pending</PopoverOption>
<PopoverOption type="radio" name="status" value="sold" disabled>Sold</PopoverOption>
</div>Minimal · Light