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