mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-30 08:04:18 +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
160 lines
5.0 KiB
TypeScript
160 lines
5.0 KiB
TypeScript
"use client"
|
|
|
|
import { ButtonGroup, ButtonGroupText } from "@/examples/base/ui/button-group"
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from "@/examples/base/ui/dropdown-menu"
|
|
import {
|
|
Field,
|
|
FieldDescription,
|
|
FieldGroup,
|
|
FieldLabel,
|
|
} from "@/examples/base/ui/field"
|
|
import {
|
|
InputGroup,
|
|
InputGroupAddon,
|
|
InputGroupButton,
|
|
InputGroupInput,
|
|
} from "@/examples/base/ui/input-group"
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverDescription,
|
|
PopoverHeader,
|
|
PopoverTitle,
|
|
PopoverTrigger,
|
|
} from "@/examples/base/ui/popover"
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipTrigger,
|
|
} from "@/examples/base/ui/tooltip"
|
|
import { ChevronDownIcon, InfoIcon, StarIcon } from "lucide-react"
|
|
import { toast } from "sonner"
|
|
|
|
export function InputGroupWithTooltip({
|
|
country,
|
|
setCountry,
|
|
}: {
|
|
country: string
|
|
setCountry: (value: string) => void
|
|
}) {
|
|
return (
|
|
<>
|
|
<FieldGroup>
|
|
<Field>
|
|
<FieldLabel htmlFor="input-tooltip-20">Tooltip</FieldLabel>
|
|
<InputGroup>
|
|
<InputGroupInput id="input-tooltip-20" />
|
|
<InputGroupAddon align="inline-end">
|
|
<Tooltip>
|
|
<TooltipTrigger
|
|
render={
|
|
<InputGroupButton className="rounded-full" size="icon-xs" />
|
|
}
|
|
>
|
|
<InfoIcon />
|
|
</TooltipTrigger>
|
|
<TooltipContent>This is content in a tooltip.</TooltipContent>
|
|
</Tooltip>
|
|
</InputGroupAddon>
|
|
</InputGroup>
|
|
<FieldDescription>
|
|
This is a description of the input group.
|
|
</FieldDescription>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="input-dropdown-21">Dropdown</FieldLabel>
|
|
<InputGroup>
|
|
<InputGroupInput id="input-dropdown-21" />
|
|
<InputGroupAddon>
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger
|
|
render={
|
|
<InputGroupButton className="text-muted-foreground tabular-nums" />
|
|
}
|
|
>
|
|
{country} <ChevronDownIcon />
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent
|
|
align="start"
|
|
className="min-w-16"
|
|
sideOffset={10}
|
|
alignOffset={-8}
|
|
>
|
|
<DropdownMenuItem onClick={() => setCountry("+1")}>
|
|
+1
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onClick={() => setCountry("+44")}>
|
|
+44
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onClick={() => setCountry("+46")}>
|
|
+46
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</InputGroupAddon>
|
|
</InputGroup>
|
|
<FieldDescription>
|
|
This is a description of the input group.
|
|
</FieldDescription>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="input-secure-19">Popover</FieldLabel>
|
|
<InputGroup>
|
|
<Popover>
|
|
<PopoverTrigger render={<InputGroupAddon />} nativeButton={false}>
|
|
<InputGroupButton variant="secondary" size="icon-xs">
|
|
<InfoIcon />
|
|
</InputGroupButton>
|
|
</PopoverTrigger>
|
|
<PopoverContent align="start">
|
|
<PopoverHeader>
|
|
<PopoverTitle>Your connection is not secure.</PopoverTitle>
|
|
<PopoverDescription>
|
|
You should not enter any sensitive information on this site.
|
|
</PopoverDescription>
|
|
</PopoverHeader>
|
|
</PopoverContent>
|
|
</Popover>
|
|
<InputGroupAddon className="text-muted-foreground pl-1">
|
|
https://
|
|
</InputGroupAddon>
|
|
<InputGroupInput id="input-secure-19" />
|
|
<InputGroupAddon align="inline-end">
|
|
<InputGroupButton
|
|
size="icon-xs"
|
|
onClick={() => toast("Added to favorites")}
|
|
>
|
|
<StarIcon />
|
|
</InputGroupButton>
|
|
</InputGroupAddon>
|
|
</InputGroup>
|
|
<FieldDescription>
|
|
This is a description of the input group.
|
|
</FieldDescription>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="url">Button Group</FieldLabel>
|
|
<ButtonGroup>
|
|
<ButtonGroupText>https://</ButtonGroupText>
|
|
<InputGroup>
|
|
<InputGroupInput id="url" />
|
|
<InputGroupAddon align="inline-end">
|
|
<InfoIcon />
|
|
</InputGroupAddon>
|
|
</InputGroup>
|
|
<ButtonGroupText>.com</ButtonGroupText>
|
|
</ButtonGroup>
|
|
<FieldDescription>
|
|
This is a description of the input group.
|
|
</FieldDescription>
|
|
</Field>
|
|
</FieldGroup>
|
|
</>
|
|
)
|
|
}
|