@yasinsensoy/web
Fast, dependency-free React and Next.js component library built on Tailwind CSS v4.
Component library for React and Next.js. Works with Tailwind CSS v4, has no runtime dependencies, and ships mobile behaviors and accessibility built in.
Installation
The project's main CSS file:
Root layout (Next.js App Router):
License
Free in development (next dev, localhost); no key is required. In production, if UIProvider's licenseKey prop is not given a valid license key, the page is locked behind a "License required" screen. The key works only on the domains it is bound to (set them in the license portal). Do not hard-code the key; read it from an environment variable.
Language (i18n)
The app's translations and the library's own texts ("Close", "Cancel"…) live in one dictionary; keys and {name} placeholders are inferred from the type. Setup is three files:
Usage:
- Pass translations to props such as
labelandtitlewitht(...); a key string (label="home.title") is not translated automatically. - Numbers and dates are formatted per
locale({count}→1,234); the plural form is chosen by the locale's rules. - Each component bundles only its own texts; an app that passes no dictionary gets the Turkish defaults.
Rules
- Import everything from the package root:
import { Button } from "@yasinsensoy/web". The package is side-effect free (sideEffectsis CSS only); bundlers drop unused components, so importing from the root adds no size. The same components are also available from subpaths (@yasinsensoy/web/button,/data-grid,/hooks,/utils,/theme…); this lets the dev server compile only the files it needs. In Next.js,experimental.optimizePackageImports: ["@yasinsensoy/web"]gives the root the same effect. - Heavy parts that only appear on interaction (confirm dialog, the gallery's fullscreen viewer, code languages) load in separate chunks via
import(); they are not part of the initial page load. - Style with Tailwind classes via
className. Conflicting classes are merged withcnand yours win. - Use theme classes for colors (
bg-primary,text-muted-foreground,border-border…); do not hard-code colors. For a new theme, define the--ui-*variables. - Components are used through props; no nested parts are written:
<Dialog title onConfirm>,<Card title footer>,<Tabs items>,<Menu trigger items>,<Table columns rows>,<TextField label name>,await confirm({...}). Lists are given as anitemsarray. - Text props such as
title,labelanddescriptionaccept both text and elements.iconis either an element (<TrashIcon />) or a name in the library given toUIProviderviaicons(icon="trash"); names are type-checked via theRegisterinterface. - The appearance vocabulary is the same on every component:
toneis meaning (primary | neutral | danger | success | warning),sizeis size (sm | md | lg),variantis style. On buttonsvariantissolid | soft | outline | ghost | link | gradient | elevated | dashedandshapeisrounded | pill | sharp. On form fieldsvariantisoutline | filled | underline | ghost. - Effects (
effect) are the same on every component and combine as an array: on pressscale | ripple | pulse | bounce; on hoverlift | border | beam | glow | tilt | shine;noneturns them off. Buttons, cards, badges, all form fields (Input,Select,NumberInput,DatePicker… and the*Fields), choice controls,Tabs,Accordion,Collapsible,Stepper,OtpInput,Timeline,TableOfContents,Countdown,Rating,Menu/ContextMenu,Sidebar,NavigationMenu,Breadcrumb,TreeView,Kanban,NotificationCenter,FileUpload,Image,Gallery,ColorSwatch,Dialog,Sheet,Popover,HoverCard,Toaster,Fabaccept it. For effects on your own element usegetEffects(["tilt", "glow"]). - App-wide appearance is set in one place; do not repeat it on every component: define it with
defineAppearance({ defaults, effects, variants })and pass it toUIProvider appearance={...}.defaultsare per-component defaultvariant,effect,tone,size,shape(the component name starting lowercase:button,card,field(all form fields),menu,dialog,tableOfContents…);effectsare your own effects (className,press,setup);variantsare your own styles (button: { neon: "…classes" },field: { glass: { extends: "filled", className } },extends,tones). Names become type-checked withRegister { appearance: typeof appearance }. Server components (Card,Badge) read the settings from thedefineAppearanceregistry; import the settings file in the root layout. Floating label:UIProvider floatingLabel; field appearance in a container:data-field-variant="filled"(all fields in that section). The focus color is the--ui-field-focusvariable. - For a link write
<Button href="/x">;asChildis not needed. Do not manage loading state by hand: whenonClick/onConfirmreturns a Promise, the component shows loading itself. - Components marked "Client component" contain
"use client". They can be used in server components, but functions (e.g.onClick) cannot be passed to them from the server; move the interactive part into a separate client component. - Mobile behaviors (closing with the back button, swipe to close, bottom sheet presentation, keyboard inset, 44 px touch targets) are built in; do not rewrite them.
- For form validation use the browser's rules (
required,type,minLength…) withFieldandForm. If the project has a Zod (or Valibot, ArkType) schema, passForm schema={Schema}and validate the same schema in the server action withvalidateForm(Schema, formData); do not writez.coerceor your own FormData parser. - Every interactive element must have a visible name or an
aria-label.
Which component?
Pick the right one among components that do similar jobs; do not build the same thing by hand.
- Form field: In forms use the
*Fieldversions instead of bare inputs (TextField,NumberField,SelectField,DateField,CheckboxField,RadioField,SliderField,OtpField,FileField…); label, description, error andFormstate come built in. Bare components (Input,Select…) are for use outside forms. - Building forms: a whole form from a schema or JSON definition →
SchemaForm(sections, conditional fields, wizard viasteps); a hand-written multi-step form →Wizard. Draft saving →draft, initial values →defaultValues(both onForm/Wizard/SchemaForm). - Repeating rows: rows that are added and removed, such as invoice lines, phone numbers or education history →
FieldArray(title, add/remove/duplicate, drag to reorder viasortable, empty state and array error built in);useFieldArrayfor your own layout. Give field names withrow.name("name")(items[0].name); userow.keyas thekey, not the index. If the schema has an array of objects,SchemaFormrenders it itself. - Country / phone: country choice →
CountryField/CountrySelect; phone with country code (submits E.164) →PhoneField/PhoneInput; for Turkish numbers only,TextField mask="phone"is enough. - Masked text: formatted inputs such as phone, licence plate, IBAN, Turkish national ID, card or date →
TextField/Inputmask(built-in names or a pattern like"(999) 999 99 99"); do not write your ownonChangeformatter. To format a stored value useapplyMask. A label inside the field that moves up while typing (floating label) →floatingLabel. - Choice: 2–5 options →
RadioGroup(variant="segment"or"card"); long list, search or remote loading →Select; free text + suggestions →Autocomplete; free tag list (keywords, email recipients) →TagInput/TagField; on/off →Switch; consent →Checkbox; star rating →Rating/RatingField; choice from nested options (category, department, multi-select) →TreeSelect/TreeSelectField; level-by-level choice (province → district → neighborhood) →Cascader/CascaderField; multi-select by moving between two lists (role permissions, visible columns, ordered choice) →Transfer/TransferField; color →ColorPicker/ColorField(only to display it:ColorSwatch). - Long text: plain text →
TextField multiline; plain text +@person/#tagmentions (comments, chat box) →MentionInput/MentionField(showing saved text →MentionView, on the serverparseMentions); rich text (headings, lists, links, images, @mentions) →RichTextEditor/RichTextField, showing saved content →RichTextView; code →CodeBlock. - File and media input: picking/uploading files →
FileUpload/FileField(layout="list" | "gallery" | "inline"); cropping, rotating, adding text/drawing to a chosen image/video, trimming video →FileUpload edit(standaloneMediaEditor). For a profile photo useedit={{ image: { crop: { aspectRatio: 1, shape: "circle" } } }}. - Multi-step work: step indicator →
Stepper; step-by-step form →Wizard. - Number: typed number (amount, quantity) →
NumberInput; rough pick within a bounded range (volume, price range) →Slider; verification code →OtpInput. - Date: single day →
DatePicker; range →DateRangePicker; time →TimePicker; countdown / timer (campaign end, exam time, call duration) →Countdown(your own UI →useCountdown; do not writesetInterval); month only (billing period, expiry) →MonthPicker/MonthField; year only →YearPicker/YearField; calendar embedded in the page →Calendar(month/year grid →MonthCalendar/YearCalendar). - Table: a list of up to a few hundred rows that can render on the server →
Table; thousands of rows, filters, editing, grouping, column management or server mode →DataGrid. Nested hierarchy (folders, categories) →TreeView; a tree in table form →DataGrid(getChildren). A long non-table list (contacts, records) →VirtualList; a feed loaded page by page →InfiniteScroll(for tens of thousands of itemsVirtualList+onLoadMore). - Layer: confirmation or a short form →
Dialog(for a question only,await confirm({...})); details/filters/menu opening from an edge, a bottom sheet resized by finger, a list over a map →Sheet(side="bottom",snapPoints,modal={false}); small panel attached to a button →Popover; small "Are you sure?" confirmation next to a button (deleting a row) →Popconfirm; preview on hovering a link →HoverCard; action list →Menu; right click →ContextMenu; short explanation → thetooltipprop orInfoTip; in-app search and commands (⌘K) →CommandPalette; introducing the UI to new users →Tour. - Buttons: single action →
Button(icon only →IconButton); connected side-by-side buttons, toolbar, split button or single/multi select buttons →ButtonGroup(overflow goes into a ⋯ menu withoverflow="menu"). - Feedback: transient notification →
toast(); message that stays on the page →Alert; loading →Skeleton(content placeholder),Spinner(small area),Progress(percentage). For a loading state on a button, return a Promise fromonClick. Turning a real component into a placeholder →<Skeleton loading>{…}</Skeleton>. Empty list, no search results, error, no connection →EmptyState(preset). The bell in the top bar, unread badge and notification list →NotificationCenter(useNotificationsfor state; a list embedded in the page:inline). - Navigation: the app's main menu →
Sidebar(bottom bar or sheet on mobile); site top menu, dropdown mega menu panel (corporate site, product page) →NavigationMenu(side sheet on mobile); page path →Breadcrumb; views on the same page →Tabs; paged list →Pagination(hreffor URL-based); table of contents and the section being read on a long page →TableOfContents(useScrollSpyfor your own menu); back-to-top button →BackToTop; primary action on mobile →Fab. - Media: single image →
Image; image/video grid, selection, fullscreen →Gallery(fullscreen only →Lightbox); video →VideoPlayer; sliding slides, product strip, logo marquee →Carousel; person →Avatar(several →AvatarGroup); status label →Badge. - Sorting: a list or grid reordered by drag and drop (todos, menu order, photo order) →
SortableList(drag only from a handle withhandle+SortableHandle); keyboard and touch built in. UsemoveItemto move an array item. Across columns →Kanban, tree →TreeView. - Planning and flow: task board (drag and drop) →
Kanban; appointment and event calendar (month/week/day/agenda) →EventCalendar; not for picking dates but for showing events in time order →Timeline. - Data visualization: axis chart, pie/donut →
Chart; small trend inside text →Sparkline; dashboard metric card (value, change, trend) →Stat. - Page layout: stacking vertically / horizontally with spacing →
Stack(direction={{ base: "column", md: "row" }},gap,separator); grid →Grid(columns={{ base: 1, md: 3 }}or, without writing breakpoints,minItemWidth="16rem"); page width and side padding →Container(queryfor@md:classes based on box width); fixed ratio image/video →AspectRatio; screen-reader-only text, a "Skip to content" link →VisuallyHidden; show/hide by screen width →Show above="md"(flicker-free;useMediaQueryonly for behavior). Tailwind classes (flex gap-4) are fine in simple cases; use these to pass responsive values as props. - Copying: copy-to-clipboard button →
CopyButton; for your own buttonuseClipboard. Do not hand-writenavigator.clipboard(it does not work on http, and the "copied" state and screen reader announcement are missing). - Hooks: open/closed state (Dialog, Sheet) →
useDisclosure(<Dialog {...modal.props}>); debounced search →useDebounce, a debounced or throttled function →useDebouncedCallback; a setting stored in the browser →useLocalStorage/useSessionStorage(hydration safe, synced across tabs); keyboard shortcut →useHotkeys("Mod+K", …)(Kbdto display it,shortcuton menu items); visibility, lazy loading →useIntersection; element size →useResizeObserver; media query →useMediaQuery. Do not rewrite these withuseEffect+addEventListener. - Layout: grouping →
Card(stylevariant; effecteffect:lift,border,beamrotating light,glowcursor light,tilt3D tilt,shine,ripple…; selected card →active); collapsible sections →Accordion; resizable panes →ResizablePanels; scroll area →ScrollArea; code →CodeBlock; JSON data (API response, config, log) as a tree →JsonView; "CONFIDENTIAL"/"DRAFT" watermark →Watermark(getWatermarkStyleon your own element); a single collapsible section or "show more" →Collapsible; writing a keyboard shortcut →Kbd; QR code →QRCode; signature →SignaturePad/SignatureField. - PWA: install →
InstallPrompt/InstallButton; new version →UpdatePrompt; connection →OfflineIndicator; notch →SafeArea; sharing →ShareButton; browser bar color →ThemeColor. - Theme: switching theme →
useTheme().setTheme; UI that shows the selected theme (picker, sun/moon icon) →ThemeView(no server/client mismatch and no flicker on first paint); transition animation →ThemeProvider transition.
Page templates
Before writing a new page, copy and adapt a suitable ready template: app-shell (app skeleton with sidebar), dashboard (KPI cards, charts, table, activity feed), settings (tabbed settings forms, server actions), login (sign-in + two-step verification code). npx @yasinsensoy/web template lists them, npx @yasinsensoy/web template dashboard copies the files into place in the project. In the skill they live in the templates/ folder.
For AI agents
This document is generated from the package's TSDoc comments (catalog.json, llms.txt and the Claude skill). To install the skill into a project run npx @yasinsensoy/web skill; run it again after updating the package.
Besides the skill there is also an MCP server: the agent can list and search components and read docs, prop tables, examples and templates on demand (get_guide, list_components, search, get_docs, get_props, list_templates, get_template). It always matches the installed version. npx @yasinsensoy/web mcp init writes the config to the project (Claude Code .mcp.json; for Cursor and VS Code --client cursor,vscode). Before using a component, read the prop table and examples in its reference file; do not invent a prop that is not in the table.
Components
- AccordionA list of collapsible sections (FAQ, filter groups, settings).
- AlertA message that needs attention within the page.
- EffectLayerClient layer of effects.
- AutocompleteA text box that filters suggestions as you type.
- AvatarProfile photo.
- BackToTop"Back to top" button: appears in the corner once the page is scrolled by
thresholdand scrolls smoothly to the top on press. - BadgeA small badge showing a status, label or number.
- BreadcrumbBreadcrumb showing where the user is on the site (Home › Products › Phones).
- ButtonA button that starts an action, or a link that looks like a button.
- CalendarMonth calendar.
- CardA card grouping content.
- CarouselScrolling slideshow: from a single image to product strips, from story-style intros to a seamless logo ticker.
- CascaderCascading picker: leveled choices like province → district → neighbourhood or category → subcategory.
- ChartChart: bar, line, area, pie, donut and scatter.
- ChatChat: a single component for both AI chat (like ChatGPT) and messaging (like WhatsApp).
- CheckboxCheckbox.
- CodeBlockSyntax-highlighted code block.
- CollapsibleA single collapsible section: "Advanced settings", "Show details", "Show more" on long text.
- ColorPickerColor picker.
- CommandPalette⌘K command palette: quick search, navigating to pages and running commands inside the app.
- CopyButtonA button that copies a value to the clipboard: on click the icon briefly becomes ✓ and "Copied" is read to the screen reader.
- CountdownCountdown or count-up: a sale ending, an event starting, exam time, a "resend code" wait, call duration.
- CountryField
CountrySelectwith its label, description and error message. - DataGridProfessional data table for large data: virtualization, multi-sort, filters, search, column resize/move/pin/hide, row and cell range selection, validated cell editing, copy/paste, undo, grouping and totals, detail rows, tree data, server mode, pagination, infinite scroll, CSV export.
- DatePickerDate picker.
- DialogModal window that opens above the page.
- EmptyStatePlaceholder area shown when there is no data to show: empty list, a search with no results, an error, no connection, no permission.
- EventCalendarEvent calendar and scheduler: month, week, day, agenda and year views.
- FabFloating action button (FAB) and speed dial.
- FormForm that manages validation together with
Field. - FieldArrayRepeating form rows with a ready-made look: title, rows, remove / duplicate buttons, drag to reorder (
sortable), add button, empty state and the array's error. - FileUploadFile upload area: single and multiple file selection in a drag-and-drop, gallery or single-row layout.
- SchemaFormGenerates a form from a schema or JSON definition: fields, labels, required flags, validation, sections and steps in one component.
- GalleryImage and video gallery: a grid, Pinterest-style masonry or Google Photos-style rows; grouping by date or your own criterion, iOS-like long-press multi-selection and a full-screen viewer.
- HoverCardPreview card that opens when hovering a link or a name: a user profile, product summary, link preview.
- IconRenders an
IconPropvalue. - ImageImage that manages its own loading, error and placeholder states.
- InfiniteScrollWrapper that loads the next page when the end of the list is reached: feeds, product lists, comments, chat history.
- InputSingle-line text input.
- JsonViewJSON viewer: shows data such as API responses, config files and log entries as a colored, collapsible tree.
- KanbanKanban board: a board that splits work into stages (columns) and optional lanes, with cards moved by dragging.
- KbdA keyboard key or shortcut.
- LabelForm field label.
- StackLays out items vertically or side by side with equal gaps between them.
- MarkdownRenders Markdown text safely; designed for streaming text such as AI responses.
- MediaEditorImage and video editor: full screen and dark like WhatsApp, made for finger use.
- MentionInputMention box: typing
@opens suggestions like people,#like tags; the selected item is added to the text highlighted. - MenuAction menu opened from a button (edit, copy, delete…).
- NavigationMenuSite header menu (mega menu): links and dropdown panels.
- NotificationCenterNotification center: a bell button, an unread count badge and a dropdown notification list.
- NumberInputInput that accepts only numbers and formats them in the locale's format while typing.
- OtpInputOne-time code (OTP), verification code and PIN input.
- PaginationPagination: numbered pages, previous/next, first/last, page size, "go to page", a record summary and "show more" in one component.
- PopoverA small panel opened from a button: quick settings, share options, a filter, an info card and so on.
- ProgressProgress bar.
- UIProviderApp-wide settings of the library.
- InstallPrompt"Install the app" card that appears once the app is installable.
- QRCodeDraws text or a URL as a QR code (SVG).
- RadioRadio button.
- RatingRating and showing scores with stars (or your own icon).
- ResizablePanelsPanels resized by dragging: layouts like sidebar + list + preview, code/output splits.
- RichTextEditorRich text editor: formatted text, headings, lists, tasks, quotes, highlighted code blocks, links, images and mentions.
- ScrollAreaScrollable area.
- SelectSelect box.
- SeparatorThin line separating content.
- SheetPanel that slides in from an edge of the screen: mobile navigation menu, filters, cart, detail panel, bottom sheet, result list over a map.
- SidebarThe app's main navigation menu: a sidebar on the left with the page content next to it.
- SignaturePadSignature pad: sign with a finger, pen or mouse.
- SkeletonFaded box holding the place of content while it loads; prevents layout shift (CLS) when the content arrives.
- SliderSlider for picking a value or a range of values.
- SortableListList sorted by drag and drop: to-dos, menu items, ordered options, gallery order or form rows (
FieldArraysortable). - SpinnerSpinning loading indicator.
- StatMetric (KPI) card for dashboards: name, large value, change from the previous period, description and trend chart.
- StepperStep indicator showing which step of a task you are on (progress chart).
- SwitchOn/off switch.
- TableData table.
- TableOfContentsIn-page table of contents: links to headings and highlights the section being read (scroll spy).
- TabsTabs switching between several views in the same area.
- TagInputTag input: turns typed text into tags with Enter or a comma.
- TextareaMulti-line text input.
- TimelineShows events or steps in chronological order on a line: activity feed, order/shipment tracking, change history, roadmap, process steps.
- ToasterPlaces notifications shown with
toaston the screen. - TooltipTooltip briefly explaining what an element does.
- TourProduct tour (onboarding): highlights elements on the page in order and shows an explanation card next to them.
- TransferTransfer between two lists: pick from the long list on the left, move to the right.
- TreeSelectSelect box from a tree: for nested options like categories, departments, folders, country > city.
- TreeViewTree view: for nested data like a file explorer, category tree, org chart, permission list.
- VideoPlayerVideo player matching the library's design.
- VirtualListList showing tens of thousands of items without stutter: only the visible items (and a few extra) are in the DOM.
- WatermarkWatermark: tiles tilted, repeated text or a logo over the content.
APIs and utilities
- HooksCloses an open layer (Dialog, Sheet, menu…) with the browser's or phone's back button.
- Language (i18n)Defines the main dictionary.
- LicenseSets the license key.
- Next.js (`@yasinsensoy/web/next`)
UIProviderready for Next.js: in-site links render withnext/link, so<Button href="/x">navigates without a page reload. - ThemeManages the app's theme: stores the user preference, follows the system preference, syncs across tabs and applies the theme to the
<html>element. - UtilitiesPasses its props to its single child instead of rendering its own element.