Mini Menu
The <MiniMenu> component displays a menu of options in a small, compact format. To use it, add <MiniMenuButton> inside the <MiniMenu>.
import { MiniMenu, MiniMenuButton } from "stylus-ui/MiniMenu";import { faLink, faBookmark, faEllipsis,} from "@fortawesome/pro-regular-svg-icons";
export default () => ( <MiniMenu> <MiniMenuButton icon={faLink} label="Copy link" /> <MiniMenuButton icon={faBookmark} label="Save for later" /> <MiniMenuButton icon={faEllipsis} label="More" /> </MiniMenu>);Variants
Section titled “Variants”Pass variant="danger" to MiniMenuButton to display a red icon on hover.
import { MiniMenu, MiniMenuButton } from "stylus-ui/MiniMenu";import { faTrash } from "@fortawesome/pro-regular-svg-icons";
export default () => ( <MiniMenu> <MiniMenuButton icon={faTrash} label="Delete" variant="danger" /> </MiniMenu>);Toggle groups
Section titled “Toggle groups”To add toggle-able groups of items, group MiniMenuToggleItem within MiniMenuToggleGroup.
import { MiniMenu, MiniMenuToggleGroup, MiniMenuToggleItem,} from "stylus-ui/MiniMenu";import { faAlignLeft, faAlignCenter, faAlignRight,} from "@fortawesome/pro-regular-svg-icons";import { faAlignLeft as faAlignLeftSolid, faAlignCenter as faAlignCenterSolid, faAlignRight as faAlignRightSolid,} from "@fortawesome/pro-solid-svg-icons";
export default () => ( <MiniMenu> <MiniMenuToggleGroup type="single" defaultValue="left"> <MiniMenuToggleItem value="left" icon={faAlignLeft} iconToggled={faAlignLeftSolid} label="Left" /> <MiniMenuToggleItem value="center" icon={faAlignCenter} iconToggled={faAlignCenterSolid} label="Center" /> <MiniMenuToggleItem value="right" icon={faAlignRight} iconToggled={faAlignRightSolid} label="Right" /> </MiniMenuToggleGroup> </MiniMenu>);Multiple select
Section titled “Multiple select”You can also set type="multiple" to enable toggling on and off multiple items in a group.
import { MiniMenu, MiniMenuButton, MiniMenuToggleGroup, MiniMenuToggleItem,} from "stylus-ui/MiniMenu";import { faBold, faItalic, faUnderline, faEllipsis,} from "@fortawesome/pro-regular-svg-icons";import { faBold as faBoldSolid, faItalic as faItalicSolid, faUnderline as faUnderlineSolid,} from "@fortawesome/pro-solid-svg-icons";
export default () => ( <MiniMenu> <MiniMenuToggleGroup type="multiple" defaultValue={[]}> <MiniMenuToggleItem value="bold" icon={faBold} iconToggled={faBoldSolid} label="Bold" /> <MiniMenuToggleItem value="italic" icon={faItalic} iconToggled={faItalicSolid} label="Italic" /> <MiniMenuToggleItem value="underline" icon={faUnderline} iconToggled={faUnderlineSolid} label="Underline" /> </MiniMenuToggleGroup> <MiniMenuButton icon={faEllipsis} label="More" disabled /> </MiniMenu>);Different toggled icon
Section titled “Different toggled icon”You can customize the appearance of the toggled item by providing a different iconToggled for the selected state.
import { MiniMenu, MiniMenuToggleGroup, MiniMenuToggleItem,} from "stylus-ui/MiniMenu";import { faBookmark as faBookmarkRegular } from "@fortawesome/pro-regular-svg-icons";import { faBookmark as faBookmarkSolid } from "@fortawesome/pro-solid-svg-icons";
export default () => ( <MiniMenu> <MiniMenuToggleGroup type="single" defaultValue="bookmark"> <MiniMenuToggleItem value="bookmark" icon={faBookmarkRegular} iconToggled={faBookmarkSolid} label="Bookmark" /> </MiniMenuToggleGroup> </MiniMenu>);API Reference
Section titled “API Reference”MiniMenu
Section titled “MiniMenu”A collection of quick actions displayed when a user hovers over an element.
asChild
dir
disableGroupHover
When true, menu does not show on parent group hover (only on focus).
loop
orientation
theme
Visual theme for the toolbar.
MiniMenuButton
Section titled “MiniMenuButton”A button within MiniMenu.
icon
Icon shown in the button (and in tooltip).
label
Accessible label and tooltip text.
asChild
variant
Visual style: default or danger (red).
MiniMenuToggleItem
Section titled “MiniMenuToggleItem”A toggle button within MiniMenu. Must be rendered inside MiniMenuToggleGroup.
icon
Icon shown when the toggle is off.
label
Accessible label and tooltip text.
value
A string value for the toggle group item. All items within a toggle group should use a unique value.
asChild
iconToggled
Optional icon shown when the toggle is on (replaces icon).
MiniMenuToggleGroup
Section titled “MiniMenuToggleGroup”A set of two-state buttons that can be toggled on or off. To be used with MiniMenuToggleItem.
type
asChild
defaultValue
The value of the item that is pressed when initially rendered. Use
defaultValue if you do not need to control the state of a toggle group.
The value of the items that are pressed when initially rendered. Use
defaultValue if you do not need to control the state of a toggle group.
dir
disabled
Whether the group is disabled from user interaction.
loop
onValueChange
The callback that fires when the value of the toggle group changes. The callback that fires when the state of the toggle group changes.
orientation
rovingFocus
Whether the group should maintain roving focus of its buttons.
value
The controlled stateful value of the item that is pressed. The controlled stateful value of the items that are pressed.