dxbh-uiGitHub

Polish

The bar every dxbh-ui item meets before it ships. It distills Emil Kowalski's design-engineering practice and Apple's Designing Fluid Interfaces. pnpm registry:check enforces the mechanical rules (marked checked). Reviewers enforce the rest.

Live docs: ui.dxbh.dev/docs/polish. Install any item with npx shadcn@latest add @dxbh-ui/<name>.

Read this before you build or review an item.

1. Decide whether it should move at all

How often people see it Decision
100+ times a day (keyboard shortcuts, palette toggle) No animation
Tens of times a day (hover, list navigation) Remove it or make it very small
Occasionally (modals, drawers, toasts) Standard motion
Rarely (onboarding, celebrations) Room for delight

2. Tokens

The @dxbh-ui/style item ships these. Components use them through Tailwind (ease-out, duration-(--duration-press)).

--ease-out: cubic-bezier(0.23, 1, 0.32, 1);     /* enter and exit */
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* on-screen movement */
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);  /* sheets and drawers */

--duration-press: 120ms;   /* press feedback */
--duration-popover: 180ms; /* popovers, tooltips, icon swaps (150–200ms) */
--duration-modal: 240ms;   /* modals, drawers (200–300ms) */

3. Press and hover

className="transition-transform duration-(--duration-press) ease-out active:scale-[0.97]"

4. Enter and exit

/* Good */
.enter { opacity: 0; transform: scale(0.95); }
/* Never */
.enter { transform: scale(0); }

5. Only cheap properties

6. Gesture UI

Use @dxbh-ui/spring and @dxbh-ui/use-snap-track. Don't write a new physics loop.

Interaction Damping Response
Default, settle, reposition 1.0 (critically damped) 0.3–0.4s
After a flick (release speed > ~400px/s) 0.8 0.3–0.4s

7. Materials

<div className="material-regular" /> // or material-thin

8. Reduced motion

Reduced motion means gentler motion, not none.

9. Accessibility and feedback

10. Portability

These rules are checked:

Review routine

  1. Play the demo in Slow-mo (the preview toolbar runs CSS animations at 0.1×). Look for two states overlapping, a wrong origin, or properties falling out of sync.
  2. Turn on Reduce motion and interact again. You should see only opacity, or nothing.
  3. Check it at 390px wide. Nothing scrolls horizontally.
  4. Test touch interactions on a real device.
  5. Look at it again the next day.