Getting started

Introduction

React components for dense, quiet product interfaces, each one taken from a project that needed it. ui-sdk handles behavior and accessibility, and StyleX handles the styles.

Where the components come from

Every component here was written for one of our own projects first, because that app needed it. Once it had held up there, it moved into NyctoUI and took on the shared tokens and the same states as the rest. New components arrive the same way.

That’s why the list has an on-screen keyboard, an iPhone frame drawn to scale and a masked API key, and why it has no carousel. The examples lean the same way. They show a calendar that blocks booked nights, a heatmap of deploys by hour and a table of ten thousand log lines, not lorem ipsum.

Principles

  • Dense and neutral. Control text is 14px, surfaces are flat, and color is kept for status. Nothing on the page should shout.
  • Built on ui-sdk. Focus, keyboard and ARIA come from a ui-sdk component wherever one exists. Most components accept the props of the part they wrap.
  • Composed from parts. A menu is a Dropdown with a trigger, content and items, not one component with an items array.
  • One height scale. Buttons, inputs and select triggers are 24, 32 or 40px, so a row of controls lines up.

Styling with sx

Components take no className or style. Overrides are StyleX styles passed to sx, merged after the built-in ones, so they win without a specificity fight.

import * as stylex from '@stylexjs/stylex'

<Button sx={styles.wide}>Continue</Button>

const styles = stylex.create({
  wide: { width: '100%' },
})

Changing the element

Parts that render an element take ui-sdk’s render prop to become another element or component, keeping their styles and behavior. There is no asChild.

<SidebarItemButton render={<Link to="/inbox" />}>…</SidebarItemButton>

<DropdownTrigger render={<Button variant="ghost" />}>…</DropdownTrigger>

Theming

Every color token is a light-dark() value, so the theme follows color-scheme. Set it on <html> to switch the whole page, or on any element to switch just that part. The theme menu at the top of the sidebar works this way.

document.documentElement.style.colorScheme = 'dark'

Dependencies

Every component needs the first four. The rest are pulled in only by the components that use them.

  • ui-sdk. @ui-sdk/react and @ui-sdk/core give focus, keyboard and ARIA behavior. Its stylesheet is not imported.
  • StyleX. @stylexjs/stylex draws every style, from tokens compiled at build time.
  • Tabler Icons. @tabler/icons-react for the components’ own glyphs, such as chevrons, checks and the spinner.
  • Geist. @fontsource-variable/geist and @fontsource-variable/geist-mono, the variable fonts for text and code.
  • TanStack Table. @tanstack/react-table for sorting, selection and pinning in Table.
  • TanStack Virtual. @tanstack/react-virtual renders only the visible rows in Table, Command and the Emoji Picker.
  • dnd-kit. @dnd-kit/core handles the pointer when rows are dragged in a Tree.
  • Emojibase. emojibase-data is the source for the Emoji Picker’s data, trimmed at build time by pnpm emoji-data.

Components

Accordion
Sections that open from their headings, one or several at a time.
Attachment
A file as a card, with its upload progress or error.
Badge
Short label for a status, a count or a category.
Banner
Strip across the top of a page for a release, a beta or an outage.
Blockquote
Words quoted from someone else, with an optional attribution.
Breadcrumbs
Trail of links to the current page, with collapsed steps.
Button
Pill-shaped action in four variants and three sizes.
Calendar
Month grids for a date, several dates or a range.
Callout
Boxed aside in the content for a tip, a note or a warning.
Character Counter
Counts characters or words in a field against a limit.
Checkbox
Box that checks and unchecks, alone or in a group.
Collapsible
Trigger that shows and hides a panel of content.
Color Picker
Picks a color from an area, sliders, typed CSS or presets.
Command
Searchable list of commands, inline or as a ⌘ K palette.
Copy Button
Copies text to the clipboard and shows that it did.
Date Picker
Date field with a calendar popup, for a date or a range.
Dialog
Modal window for a form, a document or a confirmation.
Drawer
Panel that slides in from an edge and swipes away.
Dropdown
Menu of actions, choices and submenus.
Emoji Picker
Searchable emoji grid with skin tones, loaded on demand.
Field
Label, description and error wired to a control.
File Upload
Takes files from a drop zone, the picker or a paste.
Heatmap
Grid of cells shaded by value, such as a year of activity.
Image Cropper
Crops an image with a resizable selection or a pan-and-zoom frame.
Input
Text input that works alone or with icons and addons.
Kbd
Keycap for a key or shortcut the user presses.
Keyboard
On-screen keyboard laid out like the iPhone’s and iPad’s.
Label
Names any control and passes a press on to it.
Masked Value
A key, token or card number drawn with most of it hidden.
Meter
A quantity within a range, such as storage used.
Number Input
Numeric field with step buttons, formatting and drag to scrub.
Panel
Titled card of rows, as on a settings page.
Password Input
Password field with a show toggle, Caps Lock hint and rules.
Phone
An iPhone drawn to scale, with a screen for real content.
Popover
Panel anchored to a button, for a short form or details.
Progress
How far a task has got, or that it is still running.
Resizable
Panels resized by dragging the line between them.
Scroll Area
Native scrolling with a thin bar that slides in on hover.
Segmented Control
Picks one of a few options from a row of segments.
Select
Picks one value from a list that opens over the trigger.
Sidebar
Navigation column with groups, rows and a scrolling body.
Sidebar Layout
Page with a resizable sidebar that turns into a drawer.
Skeleton
Placeholder in the shape of content that is still loading.
Slider
Picks a value or a range by dragging along a track.
Switch
Turns a setting on or off, taking effect at once.
Table
Rows of data that sort, select, pin and scroll both ways.
Tag Input
Collects tags: typed, pasted or picked from suggestions.
Textarea
Multi-line text input that can grow with its content.
Toast
Brief notices that stack in a corner and swipe away.
Tooltip
Short label for a control, shown on hover and focus.
Tree
Nested, expandable rows with arrow-key navigation.
Web Preview
A web page framed in the app, with load time and size.