import { InfoCircledIcon, StarIcon } from "@radix-ui/react-icons" import { textFieldRootPropDefs } from "@radix-ui/themes/props" import type { Meta, StoryObj } from "@storybook/react" import { IconButton } from "../../action/icon-button" import { TextField } from "./TextField" const meta = { title: "base/form/TextField", component: TextField.Root, parameters: { layout: "centered", }, tags: ["autodocs"], argTypes: { size: { control: { type: "select" }, options: textFieldRootPropDefs.size.values, defaultValue: "2", }, variant: { control: { type: "select" }, options: textFieldRootPropDefs.variant.values, defaultValue: "surface", }, color: { control: { type: "select" }, options: textFieldRootPropDefs.color.values, }, radius: { control: { type: "select" }, options: textFieldRootPropDefs.radius.values, }, disabled: { control: "boolean", }, readOnly: { control: "boolean", }, }, } satisfies Meta export default meta type Story = StoryObj /** * Default text field. */ export const Default: Story = { render: args => , } /** * Text field with leading and trailing slots. */ export const WithSlots: Story = { render: args => ( ), } /** * Different sizes of text fields. */ export const Sizes: Story = { render: args => (
{textFieldRootPropDefs.size.values.map(size => ( ))}
), } /** * Text field with different visual variants. */ export const Variants: Story = { render: args => (
{textFieldRootPropDefs.variant.values.map(variant => ( ))}
), } /** * Text field with different colors. */ export const Colors: Story = { render: args => (
{textFieldRootPropDefs.color.values.map(color => ( ))}
{textFieldRootPropDefs.color.values.map(color => ( ))}
{textFieldRootPropDefs.color.values.map(color => ( ))}
), } /** * Text field with different corner radii. */ export const Radius: Story = { render: args => (
{textFieldRootPropDefs.radius.values.map(radius => ( ))}
), } /** * Text field with different input types. */ export const Types: Story = { render: args => { const types = [ "text", "password", "email", "number", "search", "hidden", "tel", "url", "date", "time", "datetime-local", "month", "week", ] as const return (
{types.map(type => ( ))}
) }, } /** * Disabled text field. */ export const Disabled: Story = { render: args => (
), } /** * Read-only text field. */ export const ReadOnly: Story = { render: args => (
), }