import { commonProps } from "../../utils/storybook"; import { Link } from "../link"; import { RadioGroup } from "."; import type { StoryObj, Meta } from "@storybook/react"; const meta: Meta = { title: "RadioGroup", component: RadioGroup, tags: ["autodocs"], argTypes: { options: { table: { type: { detail: ` {label: string}[] | {label: React.ReactElement<{ href: string | UrlObject; children?: React.ReactNode; }>}[] `, }, }, }, asChild: { control: false, }, itemProps: { control: false, table: { category: "Anatomy Props", type: { summary: "React.ComponentProps", }, }, }, indicatorProps: { control: false, table: { category: "Anatomy Props", type: { summary: "React.ComponentProps", }, }, }, ...commonProps, }, args: { defaultValue: "default", options: [ { id: "1", label: "Default", value: "default" }, { id: "2", label: "Comfortable", value: "comfortable" }, { id: "3", label: "Compact", value: "compact" }, ], }, }; export default meta; type Story = StoryObj; const linkOption: React.ComponentProps["options"] = [ { id: "1", label: Default, value: "default" }, { id: "2", label: Comfortable, value: "comfortable" }, { id: "3", label: Compact, value: "compact" }, ]; export const Default: Story = { render: (args) => (
), }; /** * If you make the label a link, it will render as a anchor tag. */ export const Links: Story = { render: (args) => , }; Links.args = { options: linkOption, }; /** * An `` will also render when used within a form to ensure events propagate correctly. */ export const DefaultWithForm: Story = { render: (args) => (
), }; /** * An `` will also render when used within a form to ensure events propagate correctly. */ export const LinksWithForm: Story = { render: (args) => (
), }; LinksWithForm.args = { options: linkOption, };