mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-11 09:51:40 +00:00
69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { IconInfoCircle, IconStar } from "@tabler/icons-react"
|
|
|
|
import {
|
|
InputGroup,
|
|
InputGroupAddon,
|
|
InputGroupButton,
|
|
InputGroupInput,
|
|
} from "@/styles/radix-nova/ui/input-group"
|
|
import { Label } from "@/styles/radix-nova/ui/label"
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from "@/styles/radix-nova/ui/popover"
|
|
|
|
export function InputGroupButtonExample() {
|
|
const [isFavorite, setIsFavorite] = React.useState(false)
|
|
|
|
return (
|
|
<div className="grid w-full max-w-sm gap-6">
|
|
<Label htmlFor="input-secure-19" className="sr-only">
|
|
Input Secure
|
|
</Label>
|
|
<InputGroup className="[--radius:9999px]">
|
|
<InputGroupInput id="input-secure-19" className="pl-0.5!" />
|
|
<Popover>
|
|
<PopoverTrigger asChild>
|
|
<InputGroupAddon>
|
|
<InputGroupButton
|
|
variant="secondary"
|
|
size="icon-xs"
|
|
aria-label="Info"
|
|
>
|
|
<IconInfoCircle />
|
|
</InputGroupButton>
|
|
</InputGroupAddon>
|
|
</PopoverTrigger>
|
|
<PopoverContent
|
|
align="start"
|
|
alignOffset={10}
|
|
className="flex flex-col gap-1 rounded-xl text-sm"
|
|
>
|
|
<p className="font-medium">Your connection is not secure.</p>
|
|
<p>You should not enter any sensitive information on this site.</p>
|
|
</PopoverContent>
|
|
</Popover>
|
|
<InputGroupAddon className="pl-1! text-muted-foreground">
|
|
https://
|
|
</InputGroupAddon>
|
|
<InputGroupAddon align="inline-end">
|
|
<InputGroupButton
|
|
onClick={() => setIsFavorite(!isFavorite)}
|
|
size="icon-xs"
|
|
aria-label="Favorite"
|
|
>
|
|
<IconStar
|
|
data-favorite={isFavorite}
|
|
className="data-[favorite=true]:fill-primary data-[favorite=true]:stroke-primary"
|
|
/>
|
|
</InputGroupButton>
|
|
</InputGroupAddon>
|
|
</InputGroup>
|
|
</div>
|
|
)
|
|
}
|