import { textPropDefs } from "@radix-ui/themes/props" import type { Meta, StoryObj } from "@storybook/react" import { Text } from "./Text" const meta = { title: "base/typography/Text", component: Text, tags: ["autodocs"], argTypes: { children: { control: "text", description: "The content of the text", }, size: { control: "select", options: textPropDefs.size.values, description: "The size of the text", }, color: { control: "select", options: textPropDefs.color.values, description: "The color theme of the text", }, weight: { control: "select", options: textPropDefs.weight.values, description: "The font weight of the text", }, align: { control: "select", options: textPropDefs.align.values, description: "The text alignment", }, trim: { control: "select", options: textPropDefs.trim.values, description: "The text trimming behavior", }, truncate: { control: "boolean", description: "Whether to truncate the text", }, highContrast: { control: "boolean", description: "Whether to use high contrast colors", }, as: { control: "select", options: ["span", "div", "label", "p"], description: "The HTML element to render", }, }, parameters: { layout: "centered", }, args: { children: "This is a sample text component", }, } satisfies Meta export default meta type Story = StoryObj /** * Default text with standard styling. */ export const Default: Story = {} /** * Text with different sizes. */ export const Sizes: Story = { render: () => (
Size 1 - Small text Size 2 - Default text Size 3 - Large text Size 4 - Extra large text Size 5 - Huge text Size 6 - Massive text Size 7 - Gigantic text Size 8 - Colossal text Size 9 - Titanic text
), } /** * Text with different colors. */ export const Colors: Story = { render: () => (
Gray text Gold text Bronze text Brown text Yellow text Amber text Orange text Tomato text Red text Ruby text Crimson text Pink text Plum text Purple text Violet text Iris text Indigo text Blue text Cyan text Teal text Jade text Green text Grass text Lime text Mint text Sky text
), } /** * Text with different weights. */ export const Weights: Story = { render: () => (
Light weight text Regular weight text Medium weight text Bold weight text
), } /** * Text with different alignments. */ export const Alignments: Story = { render: () => (
Left aligned text Center aligned text Right aligned text
), } /** * Text with different HTML elements. */ export const Elements: Story = { render: () => (
Span element Div element Label element Paragraph element
), } /** * Text with high contrast. */ export const HighContrast: Story = { render: () => (
Normal contrast text High contrast text
), } /** * Truncated text example. */ export const Truncated: Story = { render: () => (
This is a very long text that will be truncated when it exceeds the container width
), } /** * Text with different trim options. */ export const Trim: Story = { render: () => (
Normal trim text Start trimmed text End trimmed text Both trimmed text
), }