UIR

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-panel

Usage

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

PropTypeDefault
tabs

{ key, icon, onPress? } icons in the closed bar.

ToolPanelTab[]—
tools

{ label, icon, onPress? } buttons in the open grid.

ToolPanelTool[]—
initialTab

Tab highlighted at first.

number0
onTabChange

Called when a tab is pressed.

(index, tab) => void—
closeOnSelect

Close the panel after a tool is pressed.

booleantrue
columns

Tools per row. The panel height follows the row count.

number4
toggleIcon

Toggle button content; rotates 45° when open.

ReactNode+
bottomOffset

Distance from the parent's bottom edge.

number34
sideOffset

Distance from the parent's side edges.

number10
surfaceColor

Bar and panel colour.

string"#1c1c1e"
itemColor

Tool squares and toggle colour.

string"#2a2a2d"
activeTabColor

Highlight behind the active tab.

string"#2e2e31"
labelColor

Tool label colour.

string"#9a9a9e"