Skip to main content

Dropdown

Import

import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSeparator, DropdownMenuSubTrigger, DropdownMenuSubContent } from "@sparrowengg/twigs-react";

Usage

Result
Loading...
<DropdownMenu>
  <DropdownMenuTrigger css={{
    padding: '8px',
    cursor: 'pointer',
    color: 'white',
    background: '#56B0BB',
    border: 'none',
    fontWeight: 'bold',
    borderRadius: '8px',
  }}>
    More Options
  </DropdownMenuTrigger>

  <DropdownMenuContent>
    <DropdownMenuItem>New Tab</DropdownMenuItem>

    <DropdownMenuSub>
      <DropdownMenuSubTrigger>
        More Tools
      </DropdownMenuSubTrigger>

      <DropdownMenuSubContent sideOffset={2} alignOffset={-5}>
        <DropdownMenuItem>Save Page As…</DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem>Developer Tools</DropdownMenuItem>
      </DropdownMenuSubContent>
    </DropdownMenuSub>

  </DropdownMenuContent>
</DropdownMenu>

Props

PropertyDescriptionTypeDefault
defaultOpendefault open state of dropdownbooleanfalse
opencontrolled open state
onOpenChangecallback function when dropdown open status changed
sizeSize of the Optionssm mdmd
PropertyDescriptionTypeDefault
sidepreferred side of the trigger to open the menutop right bottom leftbottom
alignpreferred alignment against the triggerstart center endcenter
onOpenChangecallback function when dropdown open status changed