pbcomponents

Installation, setup, and the React component reference.

@prosazhin/pbcomponents is a React 19 component library. The reference covers components, helpers, providers, and hooks with examples and API signatures.

Resources: GitHub · npm · Figma Community · Behance · Design system.

Installation

npm install @prosazhin/pbcomponents @prosazhin/pbstyles

The component package has React 19 as a peer dependency and uses Tailwind CSS 4. Import pbstyles in your global CSS for its design tokens:

@import 'tailwindcss';
@import '@prosazhin/pbstyles/styles/tailwind/theme.css';

Your first button

import { Button } from '@prosazhin/pbcomponents';

export default function Example() {
  return (
    <Button
      size='m'
      color='primary'
      theme='filled'
    >
      Save
    </Button>
  );
}

Dialogs and notifications

If you use Dialog, Notification, or their hooks, wrap the app in PBCProvider once:

import { PBCProvider } from '@prosazhin/pbcomponents';

export default function Layout({ children }: { children: React.ReactNode }) {
  return <PBCProvider notifications={{ top: 80 }}>{children}</PBCProvider>;
}

This site places the provider in its root layout. Other components do not require a provider.

Component colors come from pbstyles. Without setup, they follow prefers-color-scheme; set data-theme="dark" or data-theme="light" on <html> or a container to override it.

Components with href (Button, Tab, PopoverItem, Tag) accept linkComponent when you need next/link instead of a plain anchor:

import NextLink from 'next/link';
import { Button } from '@prosazhin/pbcomponents';

<Button
  href='/projects'
  linkComponent={NextLink}
>
  Projects
</Button>;

Migrating from 1.x to 2.0

BeforeAfter
Dropdown, Dropdown.Trigger, Dropdown.Content, Dropdown.ItemPopover, Popover.Trigger (put the button inside), Popover.Content, Popover.Item
DropdownItemPopoverItem
Dropdown.Content align='left' | 'right'Popover placement='bottom-start' | 'bottom-end' and other floating-ui values
SwitchToggle
Select / Search: dropdownClassName, dropdownItemClassNamepopoverClassName, popoverItemClassName
RadioGroup / InlineRadioGroup: onChange(checked, value, event)onChange(value)
Text / Content: size='s' | 'm' | 'l'size={12 | 16 | 20} — size in pixels, 10–32 available
Icon: size='s' | 'm' | 'l'size={16 | 20 | 24} — size in pixels, 12–32 available
SMLSizeType, SelectDropdownOptionType typesremoved; use OptionType instead of SelectDropdownOptionType

New in 2.0: Popover, ConfirmPopover, ConfirmDialog, Tooltip, Pagination, Progress, and the usePopover hook. Existing components gained the xs size and warning color on Badge, warning on Alert, description on Checkbox, Toggle, and Radio, a heading and error for groups, Field.Error, themes and keyboard navigation for Tabs, an accordion mode in CollapseGroup, and a mobile bottom sheet for Dialog. All popups share one look and stay on screen.

New in 2.1: the icon prop on Popover.Trigger (a chevron on the trigger button, can be turned off) and maxWidth on Tooltip.

Reference

Components

ExportPurpose
ContainerA page container with main and aside regions.
HeadlineA heading with a configurable semantic level.
ButtonAn action or link with size, color, theme and loading state.
ButtonGroupA group of buttons with a shared size.
TagAn interactive tag, link or filter.
BadgeA compact status or category label.
FieldA wrapper for a label, control, description and error state.
InputA single-line input with optional addons.
TextareaA multi-line text input.
SearchSearch and select options from a list.
SelectSelect one or multiple options from a list.
CheckboxAn independent checkbox with a label.
CheckboxGroupA checkbox group with an array of selected values.
RadioOne option in a mutually exclusive set.
RadioGroupA radio group with one selected value.
InlineRadioA compact radio option.
InlineRadioGroupA group of compact radio options.
ToggleA switch for a boolean setting.
TabsA set of tabs with an active index.
TabA tab inside Tabs or a standalone navigation item.
CollapseAn expandable disclosure with a summary.
CollapseGroupA group of disclosures.
PopoverA popup with arbitrary content; menus are built from it.
PopoverItemA menu item: action or link.
ConfirmPopoverConfirm an action in a popup next to the button.
TooltipA hint shown on hover and focus.
DialogA modal with trigger, sections and close control.
ConfirmDialogConfirm an action in a modal dialog.
AlertAn inline status message with title and actions.
NotificationA toast notification with timer and progress.
PaginationPage-by-page navigation.
ProgressA progress bar.

Helpers

ExportPurpose
ContentText with optional leading and trailing icons.
IconAn SVG icon with a defined size.
TextText with prop-controlled size and weight.

Providers

ExportPurpose
DialogProviderContext for opening dialogs from descendants.
NotificationsProviderContext for showing notifications from descendants.
PBCProviderCombined dialog and notification provider.

Hooks

ExportPurpose
useClickOutsideCalls a callback on a click or touch outside the provided elements.
useControllableStateState that can be controlled by a value prop or stored inside the component.
useCountdownReturns timer progress from 0 to 100 with pause support.
useDialogReads dialogs from DialogProvider and closes the active or a specified dialog.
useHoverControllableTracks hover as controlled or internal state.
useKeydownCalls a callback when one of the specified keys is pressed.
useMergeRefsCombines multiple React refs into one callback ref.
useNotificationsReads notifications and exposes show and hide methods.
usePopoverPopup positioning and behaviour built on floating-ui.
useScreenSizeReturns window width and height, updating on resize.
useShowDialogRegisters a dialog and returns a function to open it.

Types are available from the package root and @prosazhin/pbcomponents/types. Export pages include examples and API signatures.