# Beste UI

> Beautiful, accessible blocks, pieces and components for shadcn/ui and Tailwind CSS, built for React and Next.js. Install one with the shadcn CLI and the code is yours to edit: no runtime dependency, nothing to upgrade.

Markdown rendition of https://ui.beste.co/tools/tailwind-class-merge. Every page on the site has one: add `.md` to any address, or send `Accept: text/markdown`.

Whole catalog for LLMs: https://ui.beste.co/llms.txt. Registry index: https://ui.beste.co/r/registry.json

---
[tools](/tools)/[tailwind](/tools/category/tailwind)

# Tailwind class merge playground

See exactly what cn() keeps and what it throws away when a caller's className meets a component's own classes, with the losing classes listed.

Base classestw1

rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground

Incoming classNametw1

bg-destructive px-6 text-base

Load sampleClearCopy result

cn(base, className)tw

rounded-lg py-2 font-medium text-primary-foreground bg-destructive px-6 text-base

3 classes were dropped: a later class won the same group. Order decides, not specificity.

bg-primarypx-4text-sm

rounded-lgpy-2font-mediumtext-primary-foregroundbg-destructivepx-6text-base

[Made something you like?Blocks built on this pattern](/blocks)

## Questions

What does cn() actually do?+

It joins class strings with clsx, then hands the result to tailwind-merge, which knows which utilities belong to the same group and keeps only the last one in each. That is why a caller can pass bg-destructive and beat the component's own bg-primary without any !important.

Why did my class disappear?+

Because a later class claimed the same group. px-6 beats px-4, text-base beats text-sm, and both of those beat nothing else. The list of dropped classes on this page names every one it removed and the order that decided it.

Why can a class still not override anything?+

Two reasons, usually. The class was placed before the one it should beat, since order is what decides here rather than specificity. Or it is an arbitrary value tailwind-merge cannot group, in which case both survive and the CSS cascade picks the winner instead.

Does cn() cost anything at runtime?+

A little: it parses every class to work out which group it belongs to. Not worth thinking about for a page of components, worth thinking about inside a list that renders thousands of rows, where hoisting the constant part out of the loop is the easy win.

## Related tools

[Tailwind color scale generatorTurn one hex color into a full 50 to 950 Tailwind scale in OKLCH, with the @theme block and the shadcn tokens ready to paste.](/tools/tailwind-color-scale)[Box shadow generatorBuild a layered box-shadow the way real interfaces use it, a tight edge under a wide soft lift, then copy it as CSS, a Tailwind class or a theme token.](/tools/box-shadow)[CSS to TailwindTurn CSS declarations into Tailwind v4 utilities, with the spacing scale worked out and arbitrary values where there is no named class.](/tools/css-to-tailwind)

Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · Ship it · 

## The tools are free. So is most of the library.

1935 blocks and 989 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

[Browse the blocksBrowse the blocks](/blocks)

No signup for the tools. MIT for free blocks, commercial licence for Pro.

## Ship the interface, keep the code.

New blocks, pieces and components every week. Install one with a command and it is yours to edit. No runtime dependency, no upgrade path to fight.

[Browse the libraryBrowse the library](/blocks)[See pricingSee pricing](/pricing)

### Library

* [Blocks](/blocks)
* [Pages](/pages)
* [Pieces](/pieces)
* [Components](/components)
* [Search](/search)

### Learn

* [Docs](/docs)
* [AI & MCP](/docs/mcp)
* [Blog](/blog)
* [Free tools](/tools)
* [What's new?](/changelog)
* [Website Builder](https://beste.co)

### More

* [Pricing](/pricing)
* [Referrals](/referrals)
* [License](/license)
* [GitHub](https://github.com/beste-co/beste-ui)

### Shadcn Blocks

* [Shadcn Hero Blocks](/blocks/hero)
* [Shadcn Feature Blocks](/blocks/feature)
* [Shadcn Pricing Blocks](/blocks/pricing)
* [Shadcn CTA Blocks](/blocks/cta)
* [Shadcn FAQ Blocks](/blocks/faq)
* [Shadcn About Blocks](/blocks/about)
* [Shadcn Stats Blocks](/blocks/stats)
* [Shadcn Footer Blocks](/blocks/footer)
* [Shadcn Navigation Blocks](/blocks/navigation)
* [Shadcn Auth Blocks](/blocks/auth)
* [Shadcn Ecommerce Blocks](/blocks/ecommerce)
* [Shadcn Portfolio Blocks](/blocks/portfolio)
* [Shadcn Showcase Blocks](/blocks/showcase)
* [Shadcn Careers Blocks](/blocks/careers)
* [Shadcn Onboarding Blocks](/blocks/onboarding)
* [Shadcn Coming Soon Blocks](/blocks/coming-soon)
* [Shadcn Post Blocks](/blocks/post)
* [Shadcn Legal Blocks](/blocks/legal)
* [Shadcn Workflow Blocks](/blocks/workflow)
* [Shadcn News Blocks](/blocks/news)

© 2026, [Beste](https://beste.co). All rights reserved.