mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-08 14:35:09 +00:00
* feat: add base and radix docs * feat: transform code for display * fix * fix * fix * fix * fix * chore: remove claude files * fix * fix * fix * chore: run format:write * fix * feat: add more examples * fix * feat: add aspect-ratio * feat: add avatar * feat: add badge * feat: add breadcrumb * fix * feat: add button * fix * fix * fix * feat: add calendar and card * feat: add carousel * fix: chart * feat: add checkbox * feat: add collapsible * feat: add combobox * feat: add command * feat: add context menu * feat: add data-table dialog and drawer * feat: dropdown-menu * feat: add date-picker * feat: add empty * feat: add field and hover-card * fix: input * feat: add input * feat: add input-group * feat: add input-otp * feat: add item * feat: add kbd and label * feat: add menubar * feat: add native-select * feat: add more components * feat: more components * feat: more components * feat: add skeleton, slider and sonner * feat: add spinner and switch * feat: add more components * fix: tabs * fix: tabs * feat: add docs for sidebar * fix * fix * fi * docs: update * fix: create page * fix * fix * chore: add changelog * fix
175 lines
5.5 KiB
TypeScript
175 lines
5.5 KiB
TypeScript
import { Button } from "@/examples/base/ui/button"
|
|
import { Checkbox } from "@/examples/base/ui/checkbox"
|
|
import {
|
|
Field,
|
|
FieldDescription,
|
|
FieldGroup,
|
|
FieldLabel,
|
|
FieldLegend,
|
|
FieldSeparator,
|
|
FieldSet,
|
|
} from "@/examples/base/ui/field"
|
|
import { Input } from "@/examples/base/ui/input"
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectGroup,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from "@/examples/base/ui/select"
|
|
import { Textarea } from "@/examples/base/ui/textarea"
|
|
|
|
const months = [
|
|
{ label: "MM", value: null },
|
|
{ label: "01", value: "01" },
|
|
{ label: "02", value: "02" },
|
|
{ label: "03", value: "03" },
|
|
{ label: "04", value: "04" },
|
|
{ label: "05", value: "05" },
|
|
{ label: "06", value: "06" },
|
|
{ label: "07", value: "07" },
|
|
{ label: "08", value: "08" },
|
|
{ label: "09", value: "09" },
|
|
{ label: "10", value: "10" },
|
|
{ label: "11", value: "11" },
|
|
{ label: "12", value: "12" },
|
|
]
|
|
|
|
const years = [
|
|
{ label: "YYYY", value: null },
|
|
{ label: "2024", value: "2024" },
|
|
{ label: "2025", value: "2025" },
|
|
{ label: "2026", value: "2026" },
|
|
{ label: "2027", value: "2027" },
|
|
{ label: "2028", value: "2028" },
|
|
{ label: "2029", value: "2029" },
|
|
]
|
|
|
|
export default function FieldDemo() {
|
|
return (
|
|
<div className="w-full max-w-md">
|
|
<form>
|
|
<FieldGroup>
|
|
<FieldSet>
|
|
<FieldLegend>Payment Method</FieldLegend>
|
|
<FieldDescription>
|
|
All transactions are secure and encrypted
|
|
</FieldDescription>
|
|
<FieldGroup>
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-7j9-card-name-43j">
|
|
Name on Card
|
|
</FieldLabel>
|
|
<Input
|
|
id="checkout-7j9-card-name-43j"
|
|
placeholder="Evil Rabbit"
|
|
required
|
|
/>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-7j9-card-number-uw1">
|
|
Card Number
|
|
</FieldLabel>
|
|
<Input
|
|
id="checkout-7j9-card-number-uw1"
|
|
placeholder="1234 5678 9012 3456"
|
|
required
|
|
/>
|
|
<FieldDescription>
|
|
Enter your 16-digit card number
|
|
</FieldDescription>
|
|
</Field>
|
|
<div className="grid grid-cols-3 gap-4">
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-exp-month-ts6">
|
|
Month
|
|
</FieldLabel>
|
|
<Select items={months}>
|
|
<SelectTrigger id="checkout-exp-month-ts6">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectGroup>
|
|
{months.map((item) => (
|
|
<SelectItem key={item.value} value={item.value}>
|
|
{item.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectGroup>
|
|
</SelectContent>
|
|
</Select>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-7j9-exp-year-f59">
|
|
Year
|
|
</FieldLabel>
|
|
<Select items={years}>
|
|
<SelectTrigger id="checkout-7j9-exp-year-f59">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectGroup>
|
|
{years.map((item) => (
|
|
<SelectItem key={item.value} value={item.value}>
|
|
{item.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectGroup>
|
|
</SelectContent>
|
|
</Select>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-7j9-cvv">CVV</FieldLabel>
|
|
<Input id="checkout-7j9-cvv" placeholder="123" required />
|
|
</Field>
|
|
</div>
|
|
</FieldGroup>
|
|
</FieldSet>
|
|
<FieldSeparator />
|
|
<FieldSet>
|
|
<FieldLegend>Billing Address</FieldLegend>
|
|
<FieldDescription>
|
|
The billing address associated with your payment method
|
|
</FieldDescription>
|
|
<FieldGroup>
|
|
<Field orientation="horizontal">
|
|
<Checkbox
|
|
id="checkout-7j9-same-as-shipping-wgm"
|
|
defaultChecked
|
|
/>
|
|
<FieldLabel
|
|
htmlFor="checkout-7j9-same-as-shipping-wgm"
|
|
className="font-normal"
|
|
>
|
|
Same as shipping address
|
|
</FieldLabel>
|
|
</Field>
|
|
</FieldGroup>
|
|
</FieldSet>
|
|
<FieldSet>
|
|
<FieldGroup>
|
|
<Field>
|
|
<FieldLabel htmlFor="checkout-7j9-optional-comments">
|
|
Comments
|
|
</FieldLabel>
|
|
<Textarea
|
|
id="checkout-7j9-optional-comments"
|
|
placeholder="Add any additional comments"
|
|
className="resize-none"
|
|
/>
|
|
</Field>
|
|
</FieldGroup>
|
|
</FieldSet>
|
|
<Field orientation="horizontal">
|
|
<Button type="submit">Submit</Button>
|
|
<Button variant="outline" type="button">
|
|
Cancel
|
|
</Button>
|
|
</Field>
|
|
</FieldGroup>
|
|
</form>
|
|
</div>
|
|
)
|
|
}
|