Installation
bash
npx axis-cli add popoverUsage
tsx
import {
Button,
Input,
Label,
Popover,
PopoverContent,
PopoverTrigger,
} from '@axis-ds/ui-react'
export function Example() {
return (
<Popover>
<PopoverTrigger asChild>
<Button variant="outline">설정 열기</Button>
</PopoverTrigger>
<PopoverContent className="w-80">
<div className="grid gap-4">
<div className="space-y-2">
<h4 className="font-medium leading-none">크기 설정</h4>
<p className="text-sm text-muted-foreground">
요소의 크기를 설정합니다.
</p>
</div>
<div className="grid gap-2">
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="width">너비</Label>
<Input id="width" defaultValue="100%" className="col-span-2 h-8" />
</div>
<div className="grid grid-cols-3 items-center gap-4">
<Label htmlFor="height">높이</Label>
<Input id="height" defaultValue="auto" className="col-span-2 h-8" />
</div>
</div>
</div>
</PopoverContent>
</Popover>
)
}Components
Popover팝오버 루트 컨테이너
PopoverTrigger팝오버를 여는 트리거
PopoverContent팝오버 콘텐츠 영역
Props
Popover
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | 팝오버 열림 상태 (controlled) |
onOpenChange | (open: boolean) => void | - | 열림 상태 변경 콜백 |
modal | boolean | false | 모달 모드 여부 |
openType:
booleanDefault:
-팝오버 열림 상태 (controlled)
onOpenChangeType:
(open: boolean) => voidDefault:
-열림 상태 변경 콜백
modalType:
booleanDefault:
false모달 모드 여부
PopoverContent
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "right" | "bottom" | "left" | "bottom" | 팝오버가 나타나는 방향 |
align | "start" | "center" | "end" | "center" | 트리거 대비 정렬 |
sideOffset | number | 0 | 트리거로부터의 거리 (px) |
sideType:
"top" | "right" | "bottom" | "left"Default:
"bottom"팝오버가 나타나는 방향
alignType:
"start" | "center" | "end"Default:
"center"트리거 대비 정렬
sideOffsetType:
numberDefault:
0트리거로부터의 거리 (px)