Skip to main content
Version: 1.0.3

Dropdown

The Dropdown component provides a flexible and customizable way to create dropdown menus with various styling options, animations, and sizing variants. Built with Radix UI and Framer Motion, it offers smooth animations and accessible functionality out of the box.

Installation

ignix add component dropdown

Usage

Import the components:

import { Dropdown, DropdownItem } from '@ignix-ui/dropdown';

Basic Usage

function BasicDropdown() {
return (
<Dropdown trigger={<Button>Click me</Button>}>
<DropdownItem>Option 1</DropdownItem>
<DropdownItem>Option 2</DropdownItem>
<DropdownItem>Option 3</DropdownItem>
</Dropdown>
);
}

Props

PropTypeDefaultDescription
triggerReactNode-The element that opens the dropdown when clicked
childrenReactNode-The content rendered inside the dropdown panel
animation"default" | "fade" | "scale" | "slide" | "flip""default"Entry and exit animation style
size"sm" | "md" | "lg""md"Font size of the dropdown content
rounded"none" | "sm" | "md" | "full""md"Border radius of the dropdown panel
bg"default" | "dark" | "transparent" | "glass" | "gradient" | "primary""default"Background style of the dropdown panel
side"top" | "bottom" | "left" | "right""bottom"Which side of the trigger the dropdown opens on
sideOffsetnumber8Gap in px between the trigger and the dropdown panel
align"start" | "center" | "end""center"Alignment of the dropdown panel relative to the trigger
classNamestring-Additional CSS classes to apply
PropTypeDefaultDescription
childrenReactNode-Content of the menu item
classNamestring-Additional CSS classes to apply
onSelect(event: Event) => void-Callback fired when the item is selected
disabledbooleanfalsePrevents selection and applies disabled styles
asChildbooleanfalseMerges props onto the child element instead of rendering a wrapper