Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Pattern Kit Gallery Block for React

Twelve tileable CSS surfaces in cells on shared hairlines, with a Scale slider and a Contrast slider that repaint every cell live, and a Copy CSS button that copies the real rule for the pattern you choose.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A pattern kit for React with Base UI. Twelve surfaces (stripes, lines, dots, polka, grid, hatch, checks, diamonds, zigzag, scales, rings and corners) sit in cells on shared hairlines at the start, each drawn in nothing but CSS gradients. The end column is the controls: the header, a Scale slider from 12 to 64 px and a Contrast slider from 10 to 60 per cent, both live on every cell at once, and under them the real rule for the chosen pattern with a Copy CSS button. Choosing a cell chooses the rule; the rule shows the number you set, so what you copy is what you see. The ink is the theme's foreground mixed to a strength, so the surfaces follow light and dark. On a phone the order is the header, the sliders, the cells and the rule. It's built from Guides, Slider and CopyButton. For pattern libraries, empty states, and any page that wants a surface without an image.

FAQ

What does Copy CSS copy?

The rule for the pattern you chose, as it is shown: a .surface class with an --ink variable (the foreground mixed to your contrast), the gradient layers, the positions and the tile size at your scale. Paste it and the surface renders the same, in any project that has a --foreground colour; swap the variable for a fixed colour if it does not.

What does Contrast change?

The strength of the ink, from 10 to 60 per cent of the foreground over transparent. It is not a measured contrast ratio, so check text laid over a surface yourself.

What does Scale change?

The size of one tile in pixels, from 12 to 64. Repeating gradients (stripes, lines, hatch, rings) use it for their spacing, and the tiled ones (dots, grid, checks and the rest) use it as their background size.

Which keys work?

Tab visits the Scale slider, the Contrast slider, then each pattern cell and the Copy button. The arrow keys move a slider by a step (Home and End go to its ends). Enter or Space chooses a cell. The chosen cell has a heavier ring and an underline, so it does not rely on colour.

How does it fit on a phone?

The header and the sliders come first, then the cells in three columns, then the rule, so you can see the surfaces change as you drag. The page never scrolls sideways.

How do I add a pattern?

Add an entry to the PATTERNS list: an id, a label, a function from the tile size to its gradient layers (each with a position) and a function for the background-size. The cell, the rule and the copied text all come from that one entry.

  • Pro

    Twelve of the theme's own colour tokens as swatches on shared hairlines, each with its name and its painted value in the format you choose, and a Copy button that copies exactly that text.

  • Pro

    Type Tester Gallery

    Design assets

    A preview text field, a Weight slider, a Size slider and a Case control set one line in the theme's Sans, Serif and Mono stacks, above a table of the nine weights that marks the current one.

  • Pro

    Forty-eight drawn glyphs on shared hairlines with a search field, category tabs, a size toggle and a stroke slider, where pressing a glyph copies its name and confirms it in place.

  • Pro

    Mood Board Gallery

    Walls and tables

    A pinboard of twelve pieces of five kinds (pictures, paint chips, materials, words and type) pinned a degree off square, with a lens that dims the other kinds without moving anything.

  • Pro

    Twelve components drawn in plain boxes on shared hairlines, each with a status badge and a variant count, a status filter, and a Show variants switch that turns every drawing into its list of variants.

  • Pro

    Tone Filter Gallery

    Filter, sort and tabs

    Five greyscale swatches (Paper to Ink) with counts, a Sort by contrast button and twelve framed pictures whose tone and contrast are read from their own drawings.