Implement frontend designs from figma using Chakra UI v3 and Storybook
92
92%
Does it follow best practices?
Impact
92%
1.64xAverage score across 6 eval scenarios
Advisory
Suggest reviewing before use
import { Box } from '@chakra-ui/react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { MyComponent } from './MyComponent';
const meta = {
title: 'Components/UI/MyComponent',
component: MyComponent,
parameters: {
layout: 'centered',
backgrounds: { default: 'dark' },
},
decorators: [
(Story) => (
<Box padding="40px">
<Story />
</Box>
),
],
} satisfies Meta<typeof MyComponent>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {},
};Use the Components/UI/ title prefix to group low-level components together in Storybook's sidebar.
Form field stories need a form context. Wrap the component in a minimal form:
import { Box } from '@chakra-ui/react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Form } from '~/lib/form/components/form';
import { useTesslForm } from '~/lib/form/use-tessl-form';
import { MyField } from './MyField';
function MyFieldStory(props: React.ComponentProps<typeof MyField>) {
const form = useTesslForm({
defaultValues: { example: '' },
onSubmit: async () => {},
});
return (
<Form form={form}>
<form.AppField name="example">
{(field) => <field.MyField {...props} />}
</form.AppField>
</Form>
);
}
const meta = {
title: 'Components/Form/MyField',
component: MyFieldStory,
parameters: {
layout: 'centered',
backgrounds: { default: 'dark' },
},
decorators: [
(Story) => (
<Box padding="40px" width="400px">
<Story />
</Box>
),
],
} satisfies Meta<typeof MyFieldStory>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: { label: 'My Field' },
};
export const Required: Story = {
args: { label: 'My Field', required: true },
};
export const WithHelper: Story = {
args: { label: 'My Field', helper: 'Some helpful text' },
};
export const Disabled: Story = {
args: { label: 'My Field', disabled: true },
};Use the Components/Form/ title prefix for form field stories.
For every low-level component, include at minimum:
variant value.size value, if applicable.Disabled, Hover (via parameters.pseudo), Active, Focused where applicable.Use args for prop variations. Use render only when custom JSX wrapping is needed. Use Chakra Box in decorators — do NOT use raw HTML elements.