Skip to content

Commit 9fec203

Browse files
authored
Merge pull request #522 from dev-five-git/claude/add-component-docs-oSclO
Claude/add component docs o scl o
2 parents f5c427a + 6d9abb2 commit 9fec203

34 files changed

Lines changed: 998 additions & 0 deletions

apps/landing/src/app/(detail)/components/[component]/button/demo/Variants.tsx renamed to apps/landing/src/app/(detail)/components/[component]/button/demo/1_Variants.tsx

File renamed without changes.

apps/landing/src/app/(detail)/components/[component]/button/demo/Icon.tsx renamed to apps/landing/src/app/(detail)/components/[component]/button/demo/2_Icon.tsx

File renamed without changes.

apps/landing/src/app/(detail)/components/[component]/button/demo/Danger.tsx renamed to apps/landing/src/app/(detail)/components/[component]/button/demo/3_Danger.tsx

File renamed without changes.

apps/landing/src/app/(detail)/components/[component]/button/demo/Disabled.tsx renamed to apps/landing/src/app/(detail)/components/[component]/button/demo/4_Disabled.tsx

File renamed without changes.

apps/landing/src/app/(detail)/components/[component]/button/demo/Colors.tsx renamed to apps/landing/src/app/(detail)/components/[component]/button/demo/5_Colors.tsx

File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { PropsTable } from '@/components/PropsTable'
2+
3+
###### API
4+
5+
`Checkbox` props extends the input HTML attributes (except `type` and `onChange`).
6+
7+
<PropsTable
8+
componentProps={[
9+
{
10+
property: 'children',
11+
description: 'The label content of the checkbox',
12+
type: '`React.ReactNode`',
13+
default: '-',
14+
},
15+
{
16+
property: 'checked',
17+
description: 'Whether the checkbox is checked (controlled)',
18+
type: '`boolean`',
19+
default: '`undefined`',
20+
},
21+
{
22+
property: 'defaultChecked',
23+
description: 'Whether the checkbox is checked by default (uncontrolled)',
24+
type: '`boolean`',
25+
default: '`false`',
26+
},
27+
{
28+
property: 'disabled',
29+
description: 'Whether the checkbox is disabled',
30+
type: '`boolean`',
31+
default: '`false`',
32+
},
33+
{
34+
property: 'onChange',
35+
description: 'Callback when the checked state changes',
36+
type: '`(checked: boolean) => void`',
37+
default: '`undefined`',
38+
},
39+
{
40+
property: 'colors',
41+
description: 'Custom color variables for the checkbox',
42+
type: '```{<br> primary?: string<br> border?: string<br> text?: string<br> inputBg?: string<br> checkIcon?: string<br>}```',
43+
default: '`undefined`',
44+
},
45+
]}
46+
/>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Checkbox } from '@devup-ui/components'
2+
3+
/**
4+
* **Default**
5+
* Basic checkbox with a label. Users can click to toggle the checked state.
6+
*/
7+
export default function Default() {
8+
return <Checkbox>Agree to terms and conditions</Checkbox>
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Checkbox } from '@devup-ui/components'
2+
3+
/**
4+
* **Checked**
5+
* Use `defaultChecked` prop to set the initial checked state for uncontrolled usage, or use `checked` prop for controlled state management.
6+
*/
7+
export default function Checked() {
8+
return <Checkbox defaultChecked>Checked by default</Checkbox>
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Checkbox } from '@devup-ui/components'
2+
import { VStack } from '@devup-ui/react'
3+
4+
/**
5+
* **Disabled**
6+
* Use `disabled` prop to prevent user interaction. The checkbox will have a muted appearance and cannot be toggled.
7+
*/
8+
export default function Disabled() {
9+
return (
10+
<VStack gap="8px">
11+
<Checkbox disabled>Disabled unchecked</Checkbox>
12+
<Checkbox defaultChecked disabled>
13+
Disabled checked
14+
</Checkbox>
15+
</VStack>
16+
)
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Checkbox } from '@devup-ui/components'
2+
import { Flex } from '@devup-ui/react'
3+
4+
/**
5+
* **Colors**
6+
* Pass in an object containing color tokens into `colors` prop. You can customize the checkbox appearance using `primary`, `border`, `text`, `inputBg`, and `checkIcon` color values.
7+
*/
8+
export default function Colors() {
9+
return (
10+
<Flex flexWrap="wrap" gap="16px">
11+
<Checkbox colors={{ primary: '#10B981' }} defaultChecked>
12+
Green
13+
</Checkbox>
14+
<Checkbox colors={{ primary: 'orange' }} defaultChecked>
15+
Orange
16+
</Checkbox>
17+
<Checkbox colors={{ primary: 'steelblue' }} defaultChecked>
18+
Steel Blue
19+
</Checkbox>
20+
</Flex>
21+
)
22+
}

0 commit comments

Comments
 (0)