FareOptions
Fare classes as cards in a <fieldset>, each a native radio sharing one name.
View code
<FareOptions
legend="Choose your fare"
name="fare"
statusLabels={{ yes: "Included", no: "Not included", fee: "Available for a fee" }}
>
<FareOptions.Option value="basic" title="Basic" price="$412" features={[
{ label: "Personal item", included: "yes" },
{ label: "Carry-on bag", included: "fee" },
{ label: "Changes", included: "no" },
]} />
<FareOptions.Option value="standard" title="Standard" price="$468" priceDetail="+$56"
ribbon="Recommended" checked features={[…]} />
<FareOptions.Option value="flex" title="Flex" price="$544" priceDetail="+$132" features={[…]} />
</FareOptions>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { FareOptions } from "@sdxc/ui/travel";Renders the group: a <fieldset> named by its <legend>, with its cards stacked under 36rem
and side by side, equal width, from there. Arrow keys move between the cards and the chosen
one posts its value under name, both native radio behaviour.
Composition
The parts the component publishes, each a static property of the host.
FareOptionsFareOptions.OptionRenders one fare as a<label>card around its radio: the title and the radio, the price, then the feature list.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
legend | RemixNode | Yes | What the choice is, such as "Choose your fare"; it names the group. |
hideLegend | boolean | No | Hides the legend visually while it still names the group. |
name | string | Yes | The radio name every card shares; the chosen card's value posts under it. |
statusLabels | StatusLabels | Yes | |
children | RemixNode | Yes | The FareOptions.Option cards. |
Also accepts everything in TagProps<"fieldset">.
FareOptions.Option
| Prop | Type | Required | Description |
|---|---|---|---|
value | string | Yes | What the form posts when this fare is chosen, such as "standard". |
title | RemixNode | Yes | The fare's name, such as "Standard"; it names the radio. |
price | RemixNode | Yes | The fare's price, formatted by the caller, such as "$468". |
priceDetail | RemixNode | No | What the price covers, or the difference from the cheapest fare, such as "+$56". |
features | Feature[] | No | |
ribbon | RemixNode | No | A ribbon over the card, such as "Recommended". |
checked | boolean | No | Starts chosen. |
disabled | boolean | No | |
required | boolean | No | Makes a choice required before the form submits; set it on one card of the group. |
Also accepts everything in Omit<TagProps<"label">, "children" | "title">.
Types
| Name | Values | What it decides |
|---|---|---|
Included | "yes" | "no" | "fee" | Whether a fare includes a feature, leaves it out, or offers it for a fee. |