Skip to content

Commit 1a7ad93

Browse files
committed
feat: add basic form components
1 parent 95c15e1 commit 1a7ad93

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { FC, PropsWithChildren, HTMLAttributes } from 'react'
2+
3+
export const FieldWrapper: FC<PropsWithChildren<HTMLAttributes<HTMLDivElement>>> = ({ children, ...props }) => (
4+
<div className="flex flex-col gap-2" {...props}>
5+
{children}
6+
</div>
7+
)

src/components/Form/Form.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import clsx from 'clsx'
2+
import type { FC, HTMLAttributes, PropsWithChildren } from 'react'
3+
4+
export const Form: FC<PropsWithChildren<HTMLAttributes<HTMLFormElement>>> = ({ children, className, ...props }) => (
5+
<form className={clsx('flex flex-col gap-4', className)} {...props}>
6+
{children}
7+
</form>
8+
)

src/components/Input/Input.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import clsx from 'clsx'
2+
import type { FC, HTMLAttributes } from 'react'
3+
4+
export const Input: FC<HTMLAttributes<HTMLInputElement>> = ({ className, ...props }) => (
5+
<input className={clsx('border border-gray-300 rounded-md p-2', className)} {...props} />
6+
)

src/components/Label/Label.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { FC, HTMLAttributes, PropsWithChildren } from 'react'
2+
3+
export const Label: FC<PropsWithChildren<HTMLAttributes<HTMLLabelElement>>> = ({ children, ...props }) => (
4+
<label className="text-sm font-medium" {...props}>
5+
{children}
6+
</label>
7+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import clsx from 'clsx'
2+
import type { FC, HTMLAttributes } from 'react'
3+
4+
export const Textarea: FC<HTMLAttributes<HTMLTextAreaElement>> = ({ className, ...props }) => (
5+
<textarea className={clsx('border border-gray-300 rounded-md p-2', className)} {...props} />
6+
)

0 commit comments

Comments
 (0)