Search
πŸ’‘

Separator

Created
2026/01/17 06:20
Tags
2026/01/17 07:36

Context

Sidebarμ—μ„œ shadcn/ui의 Separator μ»΄ν¬λ„ŒνŠΈλ₯Ό ν™œμš©ν•œλ‹€. λ”°λΌμ„œ 이λ₯Ό λΆ„μ„ν•˜κ³  이해할 ν•„μš”κ°€ μžˆμ–΄ 이 글을 μž‘μ„±.

Agenda

β€’
Separator μ»΄ν¬λ„ŒνŠΈλ₯Ό λΆ„μ„ν•˜κ³  κ·Έ λ‚΄μš©μ„ μ΄ν•΄ν•˜λŠ” 것을 λͺ©ν‘œλ‘œ 함

Contents

import * as SeparatorPrimitive from '@radix-ui/react-separator'; import { cn } from '@ui/lib/utils'; import type * as React from 'react'; function Separator({ className, orientation = 'horizontal', decorative = true, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>) { return ( <SeparatorPrimitive.Root data-slot='separator' decorative={decorative} orientation={orientation} className={cn( 'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px', className, )} {...props} /> ); } export { Separator };
TypeScript
볡사
shadcn/ui의 SeparatorλŠ” radix-ui의 Primitive Separatorλ₯Ό μ‚¬μš©ν•΄ κ΅¬ν˜„ν•œλ‹€. orientation을 horizontal ν˜Ήμ€ vertical둜 λ°›μ•„ μ„Έλ‘œ, κ°€λ‘œ κ΅¬λΆ„μ„ μœΌλ‘œ μŠ€νƒ€μΌλ§ ν•œλ‹€. decorative νŒŒλΌλ―Έν„°λŠ” true일 λ•Œ λ‹¨μˆœνžˆ μ‹œκ°μ  μš”μ†Œλ‘œλ§Œ μž‘μš©ν•˜κ³  false이면 의미둠적으둜 μž‘μš©ν•˜μ§€ μ•ŠλŠ”λ‹€.