New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details β†’ β†’
Socket
Book a DemoSign in
Socket

story-ui-lib

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

story-ui-lib

A modern, reusable component library built with React, TypeScript, and Mantine β€” designed to complement the Modern design system.

latest
Source
npmnpm
Version
1.1.7
Version published
Weekly downloads
4
-89.47%
Maintainers
1
Weekly downloads
Β 
Created
Source

Story UI

npm version License: ISC Storybook

A modern, reusable component library built with React, TypeScript, and Mantine β€” designed to complement the Modern design system.

✨ Overview

Story UI provides a comprehensive set of accessible, themeable, and production-ready UI components, hooks, and utilities for building modern React applications. All components are fully typed with TypeScript and designed for easy customization.

  • Modern design: Consistent, beautiful, and accessible UI out of the box
  • TypeScript support: All components and hooks are fully typed
  • Customizable: Built on Mantine, supports theming and dark mode
  • Accessible: Follows accessibility best practices
  • Ready to use: Includes hooks, utilities, and Storybook documentation

πŸ“š Table of Contents

πŸ“¦ Installation

npm install story-ui-lib

πŸš€ Quick Start

import { MantineProvider } from '@mantine/core';
import { Notifications } from '@mantine/notifications';
import '@mantine/core/styles.css';
import '@mantine/notifications/styles.css';
import { Button } from 'story-ui-lib';

function App() {
  return (
    <MantineProvider>
      <Notifications />
      <Button>Get Started</Button>
    </MantineProvider>
  );
}

⚑ Usage

import { Button, Card, MetricCard, Toast } from 'story-ui-lib';

function MyComponent() {
  const handleClick = () => {
    Toast.success({
      title: 'Success!',
      message: 'Action completed successfully'
    });
  };

  return (
    <Card title="Dashboard">
      <MetricCard
        title="Active Users"
        value="8,549"
        changeType="positive"
        subtitle="12% increase"
        icon="πŸ‘₯"
        color="#6366f1"
      />
      <Button onClick={handleClick}>Show Toast</Button>
    </Card>
  );
}

🧩 Components

πŸ”˜ Button

Storybook Docs

Description: A button component with enhanced styling and consistent design tokens. Supports multiple variants, sizes, and states with smooth animations.

Import:

import { Button } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'md'Button size
variant'filled' | 'light' | 'outline' | 'subtle' | 'transparent' | 'gradient'No'filled'Visual style variant
color'blue' | 'green' | 'red' | 'yellow' | 'purple' | 'gray' | 'orange' | 'teal' | 'dark'No'violet'Color theme
fullWidthbooleanNofalseMakes button full width
loadingbooleanNofalseShows loading spinner
disabledbooleanNofalseDisables the button
elevatedbooleanNofalseAdds elevation shadow on hover
onMouseEnter(event: MouseEvent) => voidNoMouse enter event handler
onMouseLeave(event: MouseEvent) => voidNoMouse leave event handler
onClick(event: MouseEvent) => voidNoClick event handler

Example:

<Button variant="filled" size="md" elevated>
  Primary Action
</Button>

πŸ—‚οΈ Card

Storybook Docs

Description: A versatile container component with consistent styling and optional interactions.

Import:

import { Card } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
titlestringNoCard title
childrenReactNodeYesCard content
withBorderbooleanNotrueShow border
withShadowbooleanNotrueShow shadow
paddingstring | numberNo'lg'Padding size
headerActionReactNodeNoAction element in header
hoverablebooleanNofalseAdds hover effect

Example:

<Card title="Card Title" withBorder withShadow hoverable headerAction={<Button size="xs">Action</Button>}>
  Card content goes here
</Card>

πŸ“‹ DataTable

Storybook Docs

Description: Advanced table component with sorting and custom cell rendering.

Import:

import { DataTable } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
columnsDataTableColumn[]YesTable columns (see below)
dataany[]YesTable data
loadingbooleanNofalseShow loading state
emptyMessagestringNo'No data available'Message when no data
hoverablebooleanNotrueHighlight rows on hover
stripedbooleanNofalseShow striped rows
borderedbooleanNotrueShow border
sortablebooleanNofalseEnable sorting

DataTableColumn:

PropTypeRequiredDescription
keystringYesUnique column key
labelstringYesColumn label
widthstring | numberNoColumn width
render(value: any, row: any) => ReactNodeNoCustom cell renderer
sortablebooleanNoEnable sorting for this column
align'left' | 'center' | 'right'NoText alignment

Example:

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'status', label: 'Status', render: (value) => <Badge>{value}</Badge> }
];

<DataTable columns={columns} data={data} sortable hoverable striped />

πŸ“ˆ MetricCard

Storybook Docs

Description: Specialized card for displaying metrics with optional change indicators.

Import:

import { MetricCard } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
titlestringYesMetric label/title
valuestring | numberYesValue to display
changeType'positive' | 'negative' | 'neutral'No'neutral'Change indicator type
subtitlestringNoSubtitle or description
progressnumberNoProgress percentage (0-100)
iconReactNodeNoIcon to display
trend'up' | 'down' | 'flat'NoTrend indicator
colorstringNo'#6366f1'Color for icon/progress
size'sm' | 'md' | 'lg'No'md'Card size

Example:

<MetricCard title="Revenue" value="$125,000" changeType="positive" subtitle="15% increase" progress={75} color="#10b981" />

πŸ“Š Chart

Storybook Docs

Description: Flexible chart component supporting bar, line, pie, donut, and area charts.

Import:

import { Chart } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
type'bar' | 'line' | 'pie' | 'donut' | 'area'YesChart type
dataany[]YesChart data
dataKeystringYesData key for values
xKeystringNo'name'Data key for x-axis
titlestringNoChart title
heightnumberNo300Chart height (px)
colorsstring[]Nodefault setChart colors
loadingbooleanNofalseShow loading state
showGridbooleanNotrueShow grid lines
curvedbooleanNofalseUse curved lines (for line/area)
gradientbooleanNofalseUse gradient fill (for area)

Example:

<Chart type="bar" data={data} dataKey="value" xKey="label" title="Sales" />

πŸ“‘ Tabs

Storybook Docs

Description: Tabbed interface component for organizing content into multiple views.

Import:

import { Tabs } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
itemsTabItem[]YesArray of tab items (see below)
variant'default' | 'outline' | 'pills'No'default'Visual style variant
orientation'horizontal' | 'vertical'No'horizontal'Tab orientation

TabItem:

PropTypeRequiredDescription
valuestringYesUnique tab value
labelstringYesTab label
iconReactNodeNoOptional icon
contentReactNodeYesTab content
disabledbooleanNoDisable this tab

Example:

const tabItems = [
  { value: 'home', label: 'Home', content: <div>Home</div> },
  { value: 'settings', label: 'Settings', content: <div>Settings</div> }
];
<Tabs items={tabItems} defaultValue="home" />

πŸͺœ Steps

Storybook Docs

Description: Step-by-step progress indicator with customizable content for each step.

Import:

import { Steps } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
stepsStepItem[]YesArray of step items (see below)
currentnumberYesCurrent step index (0-based)
onChange(step: number) => voidNoCallback when step changes
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'md'Stepper size

StepItem:

PropTypeRequiredDescription
labelstringYesStep label
descriptionstringNoStep description
iconReactNodeNoOptional icon
contentReactNodeNoStep content

Example:

const steps = [
  { label: 'Setup', description: 'Configure', content: <div>Setup</div> },
  { label: 'Deploy', description: 'Deploy app', content: <div>Deploy</div> }
];
<Steps steps={steps} current={0} />

πŸ”” Toast

Storybook Docs

Description: Notification system with multiple variants and auto-dismiss. Use as a function, not a React component.

Import:

import { Toast } from 'story-ui-lib';

Toast Methods:

  • Toast.success(options)
  • Toast.error(options)
  • Toast.warning(options)
  • Toast.info(options)

ToastOptions:

PropTypeRequiredDefaultDescription
titlestringNoToast title
messagestringYesToast message
autoClosenumber | booleanNo4000Auto close delay (ms) or false for sticky
iconReactNodeNoCustom icon
withCloseButtonbooleanNotrueShow close button

Example:

Toast.success({ title: 'Success', message: 'Operation completed' });
Toast.error({ title: 'Error', message: 'Something went wrong' });

πŸͺŸ Modal

Storybook Docs

Description: Flexible modal dialog with customizable content and actions.

Import:

import { Modal } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
childrenReactNodeYesModal content
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'md'Modal size
openedbooleanYesWhether modal is open
onClose() => voidYesCallback when closed
titlestringNoModal title
withCloseButtonbooleanNotrueShow close button
closeOnClickOutsidebooleanNotrueClose on overlay click
closeOnEscapebooleanNotrueClose on escape key
footerReactNodeNoCustom footer content
loadingbooleanNofalseShow loading state

Example:

<Modal opened={opened} onClose={handleClose} title="Confirm Action" size="md">
  Are you sure you want to proceed?
</Modal>

πŸ“₯ Drawer

Storybook Docs

Description: Sliding panel component for detailed views and forms.

Import:

import { Drawer } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
childrenReactNodeYesDrawer content
titlestringNoDrawer title
onClose() => voidYesCallback when closed
sizestring | numberNo'md'Drawer size
position'left' | 'right' | 'top' | 'bottom'No'right'Drawer position
openedbooleanYesWhether drawer is open

Example:

<Drawer opened={opened} onClose={handleClose} title="User Details" position="right" size="lg">
  <UserForm />
</Drawer>

πŸ’¬ Popover

Storybook Docs

Description: Floating content container triggered by user interaction.

Import:

import { Popover } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
triggerReactNodeYesElement that triggers the popover
contentReactNodeYesPopover content
titlestringNoPopover title
withArrowbooleanNotrueShow arrow pointing to target
position'top' | 'bottom' | 'left' | 'right'No'bottom'Popover position

Example:

<Popover
  trigger={<Button>Show Info</Button>}
  title="Additional Information"
  content={<div>Detailed explanation here</div>}
  position="top"
  withArrow
/>

πŸ’‘ Tooltip

Storybook Docs

Description: Tooltip for providing helpful information on hover or focus, with accessibility support.

Import:

import { Tooltip } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
labelReactNodeYesTooltip content
childrenReactElementYesElement that triggers the tooltip
position'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end'No'top'Tooltip position
disabledbooleanNofalseDisable the tooltip
color'dark' | 'gray' | 'red' | 'pink' | 'grape' | 'violet' | 'indigo' | 'blue' | 'cyan' | 'green' | 'lime' | 'yellow' | 'orange' | 'teal'No'dark'Tooltip color theme
withArrowbooleanNotrueShow arrow
arrowSizenumberNo6Arrow size (px)
openDelaynumberNo500Delay before showing (ms)
closeDelaynumberNo100Delay before hiding (ms)

Example:

<Tooltip label="Click to save your changes">
  <Button>Save</Button>
</Tooltip>

πŸ”€ Input

Storybook Docs

Description: Input component with enhanced styling, focus states, and validation support.

Import:

import { Input } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'md'Input size
variant'default' | 'filled' | 'unstyled'No'default'Visual style variant
errorboolean | stringNoError state or message
disabledbooleanNofalseDisable the input
requiredbooleanNofalseMark as required
enhancedFocusbooleanNotrueEnhanced focus styling
...All Mantine TextInputProps except 'size'NoAll other Mantine input props

Example:

<Input label="Email" placeholder="Enter your email" />
<Input label="Password" type="password" required />
<Input label="Search" variant="filled" error="Invalid input" />

πŸ”½ Select

Storybook Docs

Description: Dropdown select component with search, clear, and validation support.

Import:

import { Select } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
options{ value: string, label: string, disabled?: boolean }[]YesSelect options
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'md'Select size
variant'default' | 'filled' | 'unstyled'No'default'Visual style variant
errorboolean | stringNoError state or message
disabledbooleanNofalseDisable the select
requiredbooleanNofalseMark as required
clearablebooleanNofalseAllow clearing selection
searchablebooleanNofalseEnable search
...All Mantine SelectProps except 'data' and 'size'NoAll other Mantine select props

Example:

const options = [
  { value: 'apple', label: 'Apple' },
  { value: 'banana', label: 'Banana' }
];
<Select options={options} label="Fruit" placeholder="Pick one" />

🚨 Alert

Storybook Docs

Description: Alert component for displaying important messages and notifications.

Import:

import { Alert } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
childrenReactNodeYesAlert content
variant'light' | 'filled' | 'outline'No'light'Visual style variant
type'info' | 'success' | 'warning' | 'error'No'info'Alert type
withIconbooleanNotrueShow icon
...All Mantine AlertProps except 'icon'NoAll other Mantine alert props

Example:

<Alert type="success" variant="filled">Operation completed successfully!</Alert>

🏷️ Badge

Storybook Docs

Description: Badge for displaying status indicators, labels, and small pieces of information.

Import:

import { Badge } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
childrenReactNodeYesBadge content
size'xs' | 'sm' | 'md' | 'lg' | 'xl'No'sm'Badge size
variant'filled' | 'light' | 'outline' | 'dot' | 'gradient'No'light'Visual style variant
color'blue' | 'green' | 'red' | 'yellow' | 'purple' | 'gray' | 'orange' | 'teal'No'blue'Badge color theme
fullWidthbooleanNofalseMakes badge full width
animatedbooleanNofalseAdds subtle animation on hover
...All Mantine BadgeProps except 'size' and 'variant'NoAll other Mantine badge props

Example:

<Badge variant="filled" color="green">Success</Badge>
<Badge size="lg" variant="outline">Large Outline</Badge>

πŸ’Έ CostCard

Storybook Docs

Description: Card for displaying cost metrics and related information, with flexible number formatting.

Import:

import { CostCard } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
labelstringYesCard label/title
valuenumberYesNumerical value to display
colorScheme'dark' | 'light'YesColor scheme for the card
datedayjs.DayjsNoOptional date for cost type cards
iconReactNodeYesIcon to display in the avatar
colorstringYesColor theme for the card
type'cost' | 'diff' | 'diff-absolute'YesType of card (determines formatting)
footerstringNoOptional footer text
maxDigitsnumberNo2Maximum fraction digits for formatting
currencystringNo'USD'Currency code for cost values

Example:

<CostCard label="Cloud Spend" value={12345.67} colorScheme="light" icon={<CloudIcon />} color="#6366f1" type="cost" date={dayjs()} />

⬇️ ExportButton

Storybook Docs

Description: A button for exporting data in multiple formats (CSV, PDF, TXT, etc.), with dropdown support for multiple export options.

Import:

import { ExportButton } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
labelstringNo'Export'Button label
iconReactNodeNoDownload iconButton icon
loadingbooleanNofalseLoading state
formatsExportFormat[]NoList of export formats (label, icon, onClick)
onClick() => voidNoClick handler for single export
...ButtonPropsAll Mantine Button props

Example:

<ExportButton label="Export Data" formats={[{ label: 'CSV', onClick: () => alert('Export CSV') }]} />

⚑ SpeedDial

Storybook Docs

Description: A floating action button that expands to show multiple quick actions, similar to Material Design's SpeedDial.

Import:

import { SpeedDial } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
actionsSpeedDialAction[]YesList of actions (icon, label, onClick)
positionobjectNo{ bottom: 32, right: 32 }Position on screen
mainIconReactNodeNoPlus iconMain button icon
mainColorstringNo'blue'Main button color
openbooleanNoControlled open state
onOpenChange(open: boolean) => voidNoOpen state handler
styleReact.CSSPropertiesNoCustom style

Example:

<SpeedDial actions={[{ icon: <IconEdit />, label: 'Edit', onClick: () => {} }]} />

πŸ”” NotificationsCenter

Storybook Docs

Description: A notification center for displaying a list of notifications, with support for marking as read, clearing, and dropdown mode.

Import:

import { NotificationsCenter } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
notificationsNotificationItem[]YesList of notifications
onMarkRead(id: string) => voidNoMark as read handler
onClear(id: string) => voidNoClear notification handler
onClearAll() => voidNoClear all handler
renderItem(item: NotificationItem) => ReactNodeNoCustom render function
dropdownModebooleanNofalseShow as dropdown
styleReact.CSSPropertiesNoCustom style

Example:

<NotificationsCenter notifications={[{ id: '1', title: 'New message', timestamp: new Date() }]} />

πŸ“Š ProgressBar

Storybook Docs

Description: A horizontal progress bar with optional label, percentage, and animation.

Import:

import { ProgressBar } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
valuenumberYesProgress value (0-100)
labelstringNoLabel above the bar
colorstringNo'blue'Bar color
showPercentagebooleanNotrueShow percentage text
stripedbooleanNofalseStriped style
animatedbooleanNofalseAnimated stripes
heightnumberNo16Bar height
styleReact.CSSPropertiesNoCustom style

Example:

<ProgressBar value={60} label="Loading..." />

πŸŒ€ CircularProgress

Storybook Docs

Description: A circular progress indicator with optional label and percentage.

Import:

import { CircularProgress } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
valuenumberYesProgress value (0-100)
labelstringNoLabel below the circle
colorstringNo'blue'Progress color
sizenumberNo80Circle size (px)
thicknessnumberNo8Stroke thickness
showPercentagebooleanNotrueShow percentage text
styleReact.CSSPropertiesNoCustom style

Example:

<CircularProgress value={75} label="Complete" />

πŸ“­ EmptyState

Storybook Docs

Description: A placeholder for empty or zero-state screens, with optional icon, description, and action.

Import:

import { EmptyState } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
titlestringNo'No Data'Title text
descriptionstringNo'There is nothing to display here yet.'Description text
iconReactNodeNoIcon above title
actionReactNodeNoAction button
childrenReactNodeNoCustom content
styleReact.CSSPropertiesNoCustom style

Example:

<EmptyState title="No Results" description="Try adjusting your filters." />

πŸ”Ž FilterBar

Storybook Docs

Description: A horizontal bar for filter controls, typically used above tables or lists.

Import:

import { FilterBar } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
childrenReactNodeYesFilter controls
gapnumberstringNo'md'
styleReact.CSSPropertiesNoCustom style
...GroupPropsAll Mantine Group props

Example:

<FilterBar><Input /><Select /></FilterBar>

Storybook Docs

Description: A search input with a search icon and optional custom right section.

Import:

import { SearchBar } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
valuestringYesInput value
onChange(value: string) => voidYesChange handler
onSearch() => voidNoSearch button handler
placeholderstringNo'Search...'Placeholder text
rightSectionReactNodeNoCustom right section
...TextInputPropsAll Mantine TextInput props

Example:

<SearchBar value={search} onChange={setSearch} onSearch={() => {}} />

πŸ“… DateRangePicker

Storybook Docs

Description: A date range picker with preset ranges and support for custom date selection.

Import:

import { DateRangePicker } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
value[Datenull, Datenull]Yes
onChange(value: [Datenull, Datenull]) => voidYes
presetstringNoPreset key
onPresetChange(preset: string) => voidNoPreset change handler
...DatePickerInputPropsAll Mantine DatePickerInput props

Example:

<DateRangePicker value={[null, null]} onChange={() => {}} />

πŸ“Š KPIGrid

Storybook Docs

Description: A responsive grid for displaying key performance indicators (KPIs) with icons, trends, and subtitles.

Import:

import { KPIGrid } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
itemsKPIItem[]YesList of KPI items
columnsnumberNo4Number of columns
minWidthnumberNo220Minimum column width
styleReact.CSSPropertiesNoCustom style
colorScheme'light''dark'No'light'

Example:

<KPIGrid items={[{ title: 'Revenue', value: '$10K' }]} />

πŸ‘€ UserProfileMenu

Storybook Docs

Description: A user avatar menu with dropdown actions for profile, settings, and logout.

Import:

import { UserProfileMenu } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
namestringYesUser name
emailstringNoUser email
avatarUrlstringNoAvatar image URL
menuItemsUserProfileMenuItem[]NoCustom menu items
dropdownModebooleanNotrueShow as dropdown
styleReact.CSSPropertiesNoCustom style

Example:

<UserProfileMenu name="Jane Doe" email="jane@example.com" />

πŸ“Š DashboardGrid

Storybook Docs

Description: A responsive, draggable grid layout for dashboard widgets.

Import:

import { DashboardGrid } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
widgetsDashboardWidget[]YesList of widgets
colsobjectNoColumns per breakpoint
rowHeightnumberNo80Row height
breakpointsobjectNoBreakpoints
margin[number, number]No[16, 16]Grid margin
onLayoutChange(layout: Layout[]) => voidNoLayout change handler
styleReact.CSSPropertiesNoCustom style

Example:

<DashboardGrid widgets={[{ id: 'w1', content: <div>Widget</div>, layout: { x: 0, y: 0, w: 4, h: 2 } }]} />

πŸ” Header

Storybook Docs

Description: A customizable app header with support for logo, title, and left/center/right content.

Import:

import { Header } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
leftReactNodeNoLeft content
centerReactNodeNoCenter content
rightReactNodeNoRight content
logoReactNodeNoLogo element
titlestringNoTitle text
stickybooleanNofalseSticky header
heightnumberNo64Header height
backgroundstringNoBackground color
styleReact.CSSPropertiesNoCustom style

Example:

<Header title="Dashboard" left={<Logo />} right={<UserProfileMenu name="Jane" />} />

Storybook Docs

Description: A customizable app footer with left/center/right content and copyright.

Import:

import { Footer } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
leftReactNodeNoLeft content
centerReactNodeNoCenter content
rightReactNodeNoRight content
copyrightstringNoCopyright text
stickybooleanNofalseSticky footer
heightnumberNo56Footer height
backgroundstringNoBackground color
styleReact.CSSPropertiesNoCustom style

Example:

<Footer left={<Logo />} right={<Text>Links</Text>} copyright="Β© 2024" />

πŸ—‚οΈ Accordion

Storybook Docs

Description: A flexible accordion component for collapsible panels, supporting nested panels and custom headers.

Import:

import { Accordion } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
panelsAccordionPanel[]YesList of panels
multiplebooleanNofalseAllow multiple open
defaultValuestringstring[]nullNo
iconPosition'left''right'No'left'
renderHeader(panel, expanded) => ReactNodeNoCustom header
renderContent(panel) => ReactNodeNoCustom content
classNamestringNoCustom class
styleReact.CSSPropertiesNoCustom style
variantstringNoMantine variant
chevronPosition'left''right'No

Example:

<Accordion panels={[{ label: 'Panel 1', value: 'p1', content: <div>Content</div> }]} />

⏳ OverlayLoader

Storybook Docs

Description: A fullscreen or container overlay loader with optional label.

Import:

import { OverlayLoader } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
labelstringNoLoader label
fullscreenbooleanNofalseFullscreen overlay
loaderReactNodeNoCustom loader
styleReact.CSSPropertiesNoCustom style

Example:

<OverlayLoader label="Loading..." fullscreen />

πŸ—ΊοΈ MapWidget

Storybook Docs

Description: A map widget for displaying locations and markers using Leaflet.

Import:

import { MapWidget } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
center[number, number]No[37.7749, -122.4194]Map center
zoomnumberNo10Zoom level
markersMapMarker[]No[]List of markers
styleReact.CSSPropertiesNoCustom style
childrenReactNodeNoCustom overlays

Example:

<MapWidget markers={[{ position: [40.7128, -74.006], popup: 'NYC' }]} />

🟒 StatusIndicator

Storybook Docs

Description: A visual indicator for status with icon, color, and optional label.

Import:

import { StatusIndicator } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
status'success' | 'error' | 'warning' | 'info' | 'pending' | 'neutral'YesStatus type
size'xs' | 'sm' | 'md' | 'lg'No'md'Indicator size
labelstringNoOptional label text
showIconbooleanNofalseShow status icon
customIconReactNodeNoCustom icon override
variant'filled' | 'light' | 'outline' | 'subtle'No'filled'Visual style variant

Example:

<StatusIndicator status="success" label="Success" showIcon />

🟣 ConfigPreviewCard

Storybook Docs

Description: Preview card for configuration sections, with title, description, and custom sections.

Import:

import { ConfigPreviewCard } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
dataanyYesData object for dynamic content
sectionsConfigPreviewSection[]YesArray of preview sections
titlestringNo'Preview'Card title
descriptionstringNoCard description

Example:

<ConfigPreviewCard
  data={{}}
  sections={[
    { key: '1', label: 'Section 1', content: 'Content 1' },
    { key: '2', label: 'Section 2', content: 'Content 2' },
  ]}
  title="Preview"
  description="This is a preview card."
/>

🟠 FormStepperNavigation

Storybook Docs

Description: Navigation controls for multi-step forms, with Continue, Submit, and Cancel actions.

Import:

import { FormStepperNavigation } from 'story-ui-lib';

Props:

PropTypeRequiredDefaultDescription
activeStepstringYesCurrent step key
canProceedToNextbooleanYesCan proceed to next step
isSubmittingbooleanYesShow loading state
onContinue() => voidYesContinue handler
onSubmit() => voidYesSubmit handler
onCancel() => voidYesCancel handler
continueLabelstringNo'Continue'Continue button label
submitLabelstringNo'Create Alert'Submit button label
cancelLabelstringNo'Cancel'Cancel button label
submitIconReactNodeNoBell iconIcon for submit button

Example:

<FormStepperNavigation
  activeStep="What"
  canProceedToNext={true}
  isSubmitting={false}
  onContinue={() => {}}
  onSubmit={() => {}}
  onCancel={() => {}}
/>

🟑 MultiStepForm

Storybook Docs

Description: Dynamic multi-step form with tab navigation, using Mantine's useForm.

Import:

import { MultiStepForm } from 'story-ui-lib';
import { useForm } from '@mantine/form';

Props:

PropTypeRequiredDefaultDescription
activeStepstringYesCurrent step key
setActiveStep(step: string) => voidYesSet active step handler
formUseFormReturnTypeYesMantine form object
stepsMultiStepFormStepConfig[]YesArray of step configs
stepsAllowedstring[]YesList of step keys that are allowed to be navigated to

Field Types:

  • "input": Standard text input
  • "select": Dropdown select
  • "multiselect": Multi-value select (new)
  • "custom": Custom render

Example with multiselect:

import { useForm } from '@mantine/form';
const [activeStep, setActiveStep] = useState('step1');
const form = useForm({ initialValues: { name: '', tags: [] } });
const steps = [
  { key: 'step1', label: 'Step 1', fields: [{ name: 'name', label: 'Name', type: 'input' }] },
  { key: 'step2', label: 'Tags', fields: [{ name: 'tags', label: 'Tags', type: 'multiselect', options: [ { value: 'a', label: 'A' }, { value: 'b', label: 'B' } ] }] },
];
const stepsAllowed = ['step1', 'step2'];
<MultiStepForm
  activeStep={activeStep}
  setActiveStep={setActiveStep}
  form={form}
  steps={steps}
  stepsAllowed={stepsAllowed}
/>

🟀 ThresholdInput

Storybook Docs

Description: Input for threshold values with color, icon, and optional suggestion button.

Import:

import { ThresholdInput } from 'story-ui-lib';
import { IconAlertCircle } from '@tabler/icons-react';

Props:

PropTypeRequiredDefaultDescription
labelstringYesThreshold label
color'red' | 'orange' | 'yellow' | 'green' | 'blue'YesColor theme
icon(props) => JSX.ElementYesIcon to display
descriptionstringNoDescription text
suggestedValuenumberNoSuggested value for auto-fill
onSuggest(value: number) => voidNoSuggest button handler
showSuggestbooleanNotrueShow suggest button
...NumberInputPropsNoAll Mantine NumberInput props

Example:

import { IconAlertCircle } from '@tabler/icons-react';
<ThresholdInput
  label="Critical Threshold"
  color="yellow"
  icon={(props) => <IconAlertCircle {...props} color="#CA8A04" />}
  value={10}
  onChange={() => {}}
/>

🟠 ThresholdsInputGroup

Storybook Docs

Description: Group of threshold inputs for multiple levels, each with its own color and icon.

Import:

import { ThresholdsInputGroup } from 'story-ui-lib';
import { IconAlertCircle } from '@tabler/icons-react';

Props:

PropTypeRequiredDefaultDescription
thresholdsThresholdConfig[]YesArray of threshold configs

Example:

import { IconAlertCircle } from '@tabler/icons-react';
const [value, setValue] = useState(10);
<ThresholdsInputGroup
  thresholds={[
    {
      label: "Critical",
      color: "yellow",
      icon: (props) => <IconAlertCircle {...props} color="#CA8A04" />,
      value,
      onChange: setValue,
    },
  ]}
/>

πŸ“ Custom Hooks

πŸ’Ύ useLocalStorage

Description: Persistent state management using localStorage. Returns a stateful value and a setter function.

Import:

import { useLocalStorage } from 'story-ui-lib';

API: const [value, setValue] = useLocalStorage(key, initialValue);

ArgumentTypeRequiredDescription
keystringYesStorage key
initialValueanyYesInitial value

Returns: [value, setValue] β€” value is the current state, setValue updates it and persists to localStorage.

Example:

const [theme, setTheme] = useLocalStorage('theme', 'light');
<Button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
  Current theme: {theme}
</Button>

πŸ”’ usePagination

Description: Complete pagination state management for lists and tables.

Import:

import { usePagination } from 'story-ui-lib';

API: const pagination = usePagination(totalItems, initialPageSize = 10);

ArgumentTypeRequiredDescription
totalItemsnumberYesTotal number of items
initialPageSizenumberNoInitial page size (default: 10)

Returns:

  • currentPage: number β€” Current page number
  • pageSize: number β€” Items per page
  • totalItems: number β€” Total items
  • setPage(page): function β€” Set current page
  • setPageSize(size): function β€” Set page size
  • nextPage(): function β€” Go to next page
  • prevPage(): function β€” Go to previous page
  • goToFirstPage(): function β€” Go to first page
  • goToLastPage(): function β€” Go to last page

Example:

const pagination = usePagination(items.length, 10);
<DataTable data={items.slice(
  (pagination.currentPage - 1) * pagination.pageSize,
  pagination.currentPage * pagination.pageSize
)} />
<Button onClick={pagination.nextPage}>Next</Button>

πŸ“‹ useCopyToClipboard

Description: Easy clipboard operations with feedback. Returns a boolean and a function to copy text.

Import:

import { useCopyToClipboard } from 'story-ui-lib';

API: const [isCopied, copyToClipboard] = useCopyToClipboard();

Return valueTypeDescription
isCopiedbooleanTrue if text was just copied
copyToClipboard(text: string) => PromiseCopies text to clipboard

Example:

const [isCopied, copyToClipboard] = useCopyToClipboard();
<Button onClick={() => copyToClipboard('Hello!')}>
  {isCopied ? 'Copied!' : 'Copy' }
</Button>

πŸ› οΈ Utilities

πŸ”£ Formatters

Description: Utility functions for formatting currency, dates, percentages, and numbers.

Import:

import { formatCurrency, formatDate, formatPercentage, formatNumber } from 'story-ui-lib';
FunctionSignatureDescription
formatCurrency(value: number, currency = 'USD', locale = 'en-US') => stringFormat as currency
formatDate(date: Date | string | dayjs.Dayjs, format = 'MMM DD, YYYY') => stringFormat date string
formatPercentage(value: number, decimals = 1) => stringFormat as percentage
formatNumber(value: number, locale = 'en-US', notation = 'standard' | 'compact') => stringFormat as number

Example:

formatCurrency(1234.56);        // "$1,234.56"
formatDate(new Date());         // "Dec 10, 2024"
formatPercentage(15.7);         // "15.7%"
formatNumber(12345, 'en-US', 'compact'); // "12.3K"

🎨 Status Helpers

Description: Consistent status color and variant mapping for UI elements.

Import:

import { getStatusColor, getStatusVariant } from 'story-ui-lib';
FunctionSignatureDescription
getStatusColor(status: 'success' | 'warning' | 'error' | 'info' | 'neutral') => stringGet color for status
getStatusVariant(status: 'success' | 'warning' | 'error' | 'info' | 'neutral') => 'filled' | 'light' | 'outline'Get variant for status

Example:

const color = getStatusColor('success');     // "#10b981"
const variant = getStatusVariant('error');   // "light"

🎨 Theming & Customization

Story UI leverages Mantine's theming system. You can customize colors, fonts, and more by passing a custom theme to MantineProvider:

import { MantineProvider, createTheme } from '@mantine/core';

const theme = createTheme({
  primaryColor: 'violet',
  fontFamily: 'Inter, sans-serif',
  // ...other theme overrides
});

function App() {
  return (
    <MantineProvider theme={theme}>
      {/* ... */}
    </MantineProvider>
  );
}

πŸ”— Storybook & Playground

πŸ“¦ Peer Dependencies

Story UI requires the following peer dependencies in your project:

  • React (>=18)
  • @mantine/core (>=7)
  • @mantine/notifications (>=7)
  • @tabler/icons-react (>=2)

Install them if not already present:

npm install react @mantine/core @mantine/notifications @tabler/icons-react

❓ FAQ & Troubleshooting

Q: My styles are missing or broken!

  • Make sure you import Mantine and notification styles in your root file:
    import '@mantine/core/styles.css';
    import '@mantine/notifications/styles.css';
    

Q: Components throw errors about missing providers?

  • Wrap your app with MantineProvider and add <Notifications /> at the root.

Q: Is TypeScript required?

  • No, but all components are fully typed and provide the best experience with TypeScript.

Q: Are components accessible?

  • Yes, all components follow accessibility best practices and use semantic HTML.

Keywords

react

FAQs

Package last updated on 09 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts