ToolPanel
A floating tab bar with a + button beside it. Tap + and the bar morphs upward into a grid of tools while the + turns into ×.
Preview
Installation
npx @codewithrabby/ui@latest add tool-panelUsage
import { ToolPanel } from "@/components/uir/tool-panel";
<View style={{ flex: 1 }}>
{/* your screen content */}
<ToolPanel
toggleIcon={<Plus color="white" size={22} />}
tabs={[
{ key: "home", icon: <Home color="white" size={20} /> },
{ key: "inbox", icon: <Inbox color="white" size={20} /> },
]}
tools={[
{ label: "Trim", icon: <Scissors color="white" size={20} />, onPress: trim },
{ label: "Crop", icon: <Crop color="white" size={20} /> },
]}
onTabChange={(index) => setTab(index)}
/>
</View>Props
| Prop | Type | Default |
|---|---|---|
tabs{ key, icon, onPress? } icons in the closed bar. | ToolPanelTab[] | — |
tools{ label, icon, onPress? } buttons in the open grid. | ToolPanelTool[] | — |
initialTabTab highlighted at first. | number | 0 |
onTabChangeCalled when a tab is pressed. | (index, tab) => void | — |
closeOnSelectClose the panel after a tool is pressed. | boolean | true |
columnsTools per row. The panel height follows the row count. | number | 4 |
toggleIconToggle button content; rotates 45° when open. | ReactNode | + |
bottomOffsetDistance from the parent's bottom edge. | number | 34 |
sideOffsetDistance from the parent's side edges. | number | 10 |
surfaceColorBar and panel colour. | string | "#1c1c1e" |
itemColorTool squares and toggle colour. | string | "#2a2a2d" |
activeTabColorHighlight behind the active tab. | string | "#2e2e31" |
labelColorTool label colour. | string | "#9a9a9e" |