Skip to content

Commit

Permalink
✨ feat: Added Textarea stories
Browse files Browse the repository at this point in the history
  • Loading branch information
caioaletroca committed Dec 17, 2024
1 parent d9b104f commit aafeba8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/ui/textarea/textarea.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Meta, Controls, Primary, Canvas } from '@storybook/blocks'
import * as Story from './textarea.stories'

<Meta of={Story} />

# Textarea

Displays a form textarea or a component that looks like a textarea.

### Default

<Canvas of={Story.Default} />

<Controls />
35 changes: 35 additions & 0 deletions src/components/ui/textarea/textarea.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ComponentProps } from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Textarea } from '.'
import { FormProvider, useForm } from 'react-hook-form'

const meta: Meta<ComponentProps<'textarea'>> = {
title: 'Primitives/Textarea',
component: Textarea,
argTypes: {
disabled: {
type: 'boolean',
description: 'If the input is disabled'
},
className: {
type: 'string',
description: "The input's class"
}
}
}

export default meta

export const Default: StoryObj<ComponentProps<'textarea'>> = {
args: {
placeholder: 'Textarea...'
},
render: (args) => {
const form = useForm()
return (
<FormProvider {...form}>
<Textarea {...args} />
</FormProvider>
)
}
}

0 comments on commit aafeba8

Please sign in to comment.