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/pbstylesThe 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.
Themes and Next.js links
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
| Before | After |
|---|---|
Dropdown, Dropdown.Trigger, Dropdown.Content, Dropdown.Item | Popover, Popover.Trigger (put the button inside), Popover.Content, Popover.Item |
DropdownItem | PopoverItem |
Dropdown.Content align='left' | 'right' | Popover placement='bottom-start' | 'bottom-end' and other floating-ui values |
Switch | Toggle |
Select / Search: dropdownClassName, dropdownItemClassName | popoverClassName, 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 types | removed; 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
| Export | Purpose |
|---|---|
| Container | A page container with main and aside regions. |
| Headline | A heading with a configurable semantic level. |
| Button | An action or link with size, color, theme and loading state. |
| ButtonGroup | A group of buttons with a shared size. |
| Tag | An interactive tag, link or filter. |
| Badge | A compact status or category label. |
| Field | A wrapper for a label, control, description and error state. |
| Input | A single-line input with optional addons. |
| Textarea | A multi-line text input. |
| Search | Search and select options from a list. |
| Select | Select one or multiple options from a list. |
| Checkbox | An independent checkbox with a label. |
| CheckboxGroup | A checkbox group with an array of selected values. |
| Radio | One option in a mutually exclusive set. |
| RadioGroup | A radio group with one selected value. |
| InlineRadio | A compact radio option. |
| InlineRadioGroup | A group of compact radio options. |
| Toggle | A switch for a boolean setting. |
| Tabs | A set of tabs with an active index. |
| Tab | A tab inside Tabs or a standalone navigation item. |
| Collapse | An expandable disclosure with a summary. |
| CollapseGroup | A group of disclosures. |
| Popover | A popup with arbitrary content; menus are built from it. |
| PopoverItem | A menu item: action or link. |
| ConfirmPopover | Confirm an action in a popup next to the button. |
| Tooltip | A hint shown on hover and focus. |
| Dialog | A modal with trigger, sections and close control. |
| ConfirmDialog | Confirm an action in a modal dialog. |
| Alert | An inline status message with title and actions. |
| Notification | A toast notification with timer and progress. |
| Pagination | Page-by-page navigation. |
| Progress | A progress bar. |
Helpers
| Export | Purpose |
|---|---|
| Content | Text with optional leading and trailing icons. |
| Icon | An SVG icon with a defined size. |
| Text | Text with prop-controlled size and weight. |
Providers
| Export | Purpose |
|---|---|
| DialogProvider | Context for opening dialogs from descendants. |
| NotificationsProvider | Context for showing notifications from descendants. |
| PBCProvider | Combined dialog and notification provider. |
Hooks
| Export | Purpose |
|---|---|
| useClickOutside | Calls a callback on a click or touch outside the provided elements. |
| useControllableState | State that can be controlled by a value prop or stored inside the component. |
| useCountdown | Returns timer progress from 0 to 100 with pause support. |
| useDialog | Reads dialogs from DialogProvider and closes the active or a specified dialog. |
| useHoverControllable | Tracks hover as controlled or internal state. |
| useKeydown | Calls a callback when one of the specified keys is pressed. |
| useMergeRefs | Combines multiple React refs into one callback ref. |
| useNotifications | Reads notifications and exposes show and hide methods. |
| usePopover | Popup positioning and behaviour built on floating-ui. |
| useScreenSize | Returns window width and height, updating on resize. |
| useShowDialog | Registers 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.