A number field with its unit beside it. Switching the unit converts the amount and the figure counts across to the new value rather than jumping, so it is clear the quantity is the same.
A number field with its unit beside it. Switching the unit converts the amount and the figure counts across to the new value rather than jumping, so it is clear the quantity is the same.
A number box with a unit beside it that settles what happens to the number when the unit changes. Reach for it wherever a form asks for a length rather than a count: a spacing, padding or radius field in a theme or design-token editor, a font-size control in a settings panel, page margins for a print or PDF export, a width or breakpoint in a layout builder, a canvas or image size, a CSS value in an admin or CMS style panel, a chart axis or gutter, a wrapper for the one CSS length a white-label tenant is allowed to set. Common asks it answers: "unit input react", "shadcn unit input", "number input with unit dropdown", "css length input react", "px rem input react", "px to rem converter component", "input with unit selector shadcn", "length field with units react", "css unit picker react", "convert px to rem in javascript", "CSS.px(16).to('rem') throws", "Cannot convert to px typed om", "CSSUnitValue to rem TypeError", "how many px is 1rem javascript", "get root font size javascript", "getComputedStyle fontSize rem base", "px rem round trip loses value", "1.06rem is not 17px", "value changes when I switch units", "unit dropdown changes my number", "width 16 not working css", "unitless length invalid css", "css unitless zero only", "input type number step per unit", "arrow key step 0.25 rem", "0.30000000000000004 spacing input", "parse 1.5rem in javascript", "split number and unit javascript", "paste 1.5rem into input", "単位付き 数値入力 react", "px rem 切り替え 入力欄", "css 長さ 入力 コンポーネント", "単位を変えたら値が変わる", "design token editor length input", "tailwind spacing scale input", "css custom property length input", "css variable px rem editor", "style dictionary token input react", "token studio px rem", "storybook control for css length", "theme editor spacing field react", "border radius input react", "letter spacing input react", "clamp value input react", "viewport unit input vw vh react", "print margin input mm inch", "デザイントークン 長さ 入力", "余白設定 px rem 切り替え". **Changing the unit is the whole component, because there are two different right answers and picking silently is what makes a field untrustworthy.** Converting keeps the rendered length and moves the number (16px becomes 1rem); reinterpreting keeps the number and moves the length (16px becomes 16rem, which renders at 256px — sixteen times bigger). Both are what somebody means, in different moments, so `behavior` names the one you want and the default converts. **It will not convert a unit it cannot account for, and that refusal is the platform's own.** Typed OM converts any fixed unit into any other — measured in Chrome 152, `CSS.px(96).to("in")` is `1in` and `.to("cm")` is `2.54cm` — and throws `TypeError: Cannot convert to px` on rem, em, %, ch, ex, lh, vw, vh, vmin and vmax, all ten of them, because a number does not know how big it is. So the fixed units convert with no help, and the relative ones convert only once `base` says what they are worth; without it the number is carried across unchanged and the field says it was carried, rather than dividing by an assumed 16 and moving a value nobody touched. The base is the caller's because it is a fact about the page, and because it is live: setting the root font-size to 20px makes `width: 1rem` compute to 20px on the next read, so a component that cached 16 would be wrong from then on. `readBase(element)` is exported to read the current ones off the document in a line. **A round trip gives back what was typed, which rounding harder does not achieve.** Over 1 to 200px against a 16px root, rounding a px→rem→px trip to 2 decimals returns the original for 50 of the 200 — 17px leaves as 1.06rem and comes back 16.96px — and against a 15px root, somebody who set `html { font-size: 15px }`, exactly 65 of 200 survive at 2, 3 and 4 decimals alike, because 1/15 does not terminate in decimal and more places never recover it. The number is therefore remembered per unit for as long as the edit lasts and restored on the way back, not recomputed; typing is a new intention and drops the memory. **A bare number is refused except as zero, which is what CSS does.** Measured, `CSS.supports("width", "16")` is false while `"0"`, `"0.0"` and `"-0"` are all true, and assigning the unitless string to `element.style.width` is a silent no-op that leaves the previous value standing — so a non-zero number with no unit is marked invalid and never posted, while `""` can still be offered in the list for the properties where it is legal (`line-height: 1.5` and `z-index: 3` both measured valid). **The arrow keys step by the unit on screen**, 1 for px and 0.25 for rem and em out of `DEFAULT_STEPS`, with Shift taking ten at once, and each step rounds to the decimals in play because ten additions of 0.1 in IEEE 754 land on 0.9999999999999999. `minPx`/`maxPx` are given in pixels so one bound means one thing in every unit; they are reported rather than silently applied while typing, and the arrow keys stop at them. Pasting `1.5rem` into the number box splits it and moves the unit, since that is how a value copied out of devtools arrives; unit identifiers are matched case-insensitively (`16PX`, `1q`) and the canonical spelling comes back. Parsing is stricter than `Number` on the reasoning this registry's number-range-input gives: `1e3`, `0x10`, `Infinity` and `1,5` are all numbers to `Number` and none of them is a length somebody typed, so they are refused and the text stays on screen to be corrected instead of being deleted out from under the reader. The two controls are one `role="group"` with a label, each separately labelled, the box is `type="text"` with `inputMode="decimal"` rather than `type="number"` — a number input discards text it cannot parse, so `16q` would vanish instead of being explained — one polite status line carries either the resolved pixel length or the problem and is wired to the box with `aria-describedby`, `aria-invalid` follows the actual fault, and a `name` posts canonical CSS (`1.5rem`) through a hidden input and posts nothing when the value is one it would not stand behind. `parseUnitValue`, `convertLength`, `resolvePx`, `toCssLength`, `stepValue` and `ABSOLUTE_PX` are exported as plain functions so the route handler that receives the string reaches the same answer the field showed. The fixed table is derived from cm the way CSS defines it rather than written out, which is also the only form that agrees with the engine bit for bit: `96/25.4` is 3.7795275590551185 in IEEE 754 where Chrome reports 3.7795275590551176. Official shadcn/ui has nothing of the kind and the measurement is not close: fetching every entry in its registry today — 65 listed, 62 fetchable, `code-block`, `questionnaire` and `trace` 404 on both style tracks — and searching all 223,287 bytes of it, `convertUnit`, `parseUnit`, `unitless`, `CSSUnitValue`, `getComputedStyle`, `fontSize`, `toFixed`, `"rem"`, `'rem'` and `unitSystem` are every one of them a zero hit; its `input` is a bare text box and `input-group` only puts ornaments either side of one, and official never reads a computed style anywhere. Within pulld it is the length end of the field family: `number-input` counts things with steppers, `number-range-input` holds a from-and-to pair, `currency-input` formats money and `duration-input` reads a span of time — each of those is one unit that never changes, and this is the one where the unit is part of the value. No dependencies beyond React and your `cn`.
Iconaut unlink icon, line, with native fits at 16/20/24px. MIT.
Iconaut unlink icon, duotone, with native fits at 16/20/24px. MIT.
Iconaut unlink icon, solid, with native fits at 16/20/24px. MIT.
Iconaut unlock icon, line, with native fits at 16/20/24px. MIT.
Iconaut unlock icon, duotone, with native fits at 16/20/24px. MIT.
An UnlockFaceId component for SmoothUI.
Iconaut unlock icon, solid, with native fits at 16/20/24px. MIT.
New-messages line that draws out, counts up and folds away once read.
Persistent save and discard actions with busy, error, and page-exit warnings.
A leave guard for a form with unsaved changes: it holds the departure, asks whether the work should be discarded, and lets it through only when the answer is yes. Reach for it wherever a screen holds work that only exists in the browser: a long or multi-step form, a profile or settings page, a post, comment or article editor, an invoice, order or booking being filled in, a canvas, diagram or query builder, an upload that has been configured but not started, and any modal a user can wander out of. Common asks it answers: "unsaved changes warning react", "are you sure you want to leave this page", "beforeunload react hook", "useBeforeUnload", "prompt before leaving page react", "block navigation react router", "useBlocker alternative", "next.js unsaved changes warning", "next.js prevent navigation", "confirm before leaving form", "dirty form guard", "warn user before closing tab", "onbeforeunload not working", "react router prompt replacement", "shadcn unsaved changes dialog", "discard changes dialog", "route change confirmation react". The reason to install one rather than write four lines is that the four lines guard the wrong door. beforeunload fires when the browser unloads the document — closing the tab, reloading, typing a new URL, following a link off the site. Clicking a next/link or a React Router Link is none of those: the document stays exactly where it is, the router swaps what is rendered, and the half-filled form is gone without the browser ever being consulted. So the guard everyone ships protects the tab button and lets every single in-app route change walk straight past it, which is the way people actually lose the work. beforeunload is not straightforward on its own terms either. The spec settled on preventDefault() while older engines only look at returnValue having been set, so a handler that does one of the two is silently dead in some browsers. Custom wording is discarded by every current browser, so the message you actually control is the in-app one. And nothing fires at all on a page the user has never clicked or typed into, because browsers require sticky activation before they will interrupt a departure. This component does the browser half correctly and then covers the two departures it cannot see, each with the mechanism that is right for it. Link clicks are caught by a capture-phase listener on document, which runs before React's root listener and therefore before any router's handler; both preventDefault() and stopPropagation() are called, because routers differ on whether they check defaultPrevented and stopping the event short of the React root is true of all of them. Answering "discard" replays the original click on the same anchor, so the router handles it exactly as it would have — no full page reload, no reimplementation of routing. Back and forward are caught with the Navigation API's navigate event, the only thing in a browser that can actually refuse a traversal: popstate is announced after the history entry has already changed, and the usual workaround of pushing a sentinel entry to have something to pop leaves a duplicate entry and a back press that does nothing for the rest of the session. That trade is refused here rather than hidden, so the reach is stated plainly: where window.navigation is missing, back is not intercepted, and the way to cover it — along with navigation your own code starts — is the guard prop, which takes a blocker from your router (React Router's useBlocker drops straight in) and stands the built-in interception down while keeping the browser-level warning. Just as deliberate is what is never held: a router.push the app itself makes, because the redirect after a successful save is exactly that and blocking it traps someone on a form they have already submitted; cross-origin links, which are a real unload and which beforeunload already covers; hash links, downloads, target="_blank", and cmd, ctrl, shift or middle clicks, every one of which leaves this page where it is. Official shadcn/ui has nothing in this area — beforeunload, unsaved, dirty and blocker appear in none of its sixty-three components, and it ships no navigation blocking of any kind. Within pulld it is distinct from confirm-button, which guards a destructive action somebody deliberately clicked; this one interrupts a departure nobody thought of as destructive. It pairs with save-status and form-error-summary on the same screen. The dialog is an alertdialog because it interrupts rather than being asked for, and focus lands on "keep editing" rather than on discard, so an Enter press already on its way to the page cannot answer with the destructive choice; Escape does the same as keep editing, and there is no third way out that would leave the navigation in limbo. Once a departure has been answered the browser stops asking the same question, and starts again the moment the user touches the page still holding unsaved work. useUnsavedChanges() is exported for a dialog of your own, useBeforeUnload() for the browser half alone, every colour is a shadcn token so it follows light and dark, and the whole thing is one file with no dependency beyond the icon.
Weightless glowing dust that drifts upward and curls away from the cursor.
Upgrade prompt card with a title, a short description of what the paid plan unlocks and an Upgrade button. Place it where a free user hits a gated feature.
Inline paywall at a limit, with a padlock that lifts as you reach Upgrade.
File upload field for BuzzForm v2 with dropzone, avatar, gallery, and inline variants.
Hand-drawn upload icon that draws itself in and wiggles. MIT licensed.
Iconaut upload icon, line, with native fits at 16/20/24px. MIT.
Animated upload icon
Iconaut upload icon, duotone, with native fits at 16/20/24px. MIT.
The list of files under a dropzone or file picker — one row each with the file name, its size, a progress bar while it uploads, an error with a retry button when it fails, and an X to drop it from the queue. Use it on any screen that accepts files: an attachment picker, an image or avatar upload, a CSV/spreadsheet import step, a document or PDF upload, a bulk media drop, or an import wizard. Common asks it answers: "file upload list", "upload queue", "show selected files with progress", "file list with remove button", "upload progress bar per file", "attachment list", "retry failed upload", "Dropbox/Gmail-style upload rows". shadcn/ui ships nothing that tracks an upload: its attachment component renders a file that is already attached — media, title, actions — with no status, no progress and no retry, and its progress primitive is a single bar with no notion of a file, so the row layout, the byte formatting, the per-file progress and the failure affordance are hand-rolled every time. It pairs with the file-dropzone component, which hands you a File[] and deliberately stops there: this is the half that shows what happened to those files. Pass an `items` array of `{ id, name, size?, status, progress?, error? }` where status is pending | uploading | done | error; omit `progress` and the bar goes indeterminate for uploads with no known length, and an empty array renders nothing so you can mount it unconditionally next to your queue state. It is presentational on purpose and never uploads anything — you keep the requests, the concurrency, the cancellation and the retry policy, and pass `onRemove`/`onRetry` to get the buttons. Accessibility is where a queue usually goes wrong and this one is built around it: progress sits in a role=progressbar, which is not a live region, so a file crawling from 1% to 100% does not narrate every tick; instead an always-mounted role=status region announces only the rows that just finished or just failed, batched into one message per change; the first render is treated as the starting state, so a list that mounts with finished rows stays silent; and every remove/retry button carries the file name in its accessible name, because a column of buttons all called "Remove" is unusable without sight of the row. Sizes are formatted to KB/MB/GB with tabular numerals, long names truncate with a title tooltip, and it is styled with shadcn tokens (muted-foreground, destructive, primary, accent, ring) so it follows light and dark themes; lucide-react is the only dependency. Distinct from save-status, which is a one-line indicator for a single background save, and from progress-ring, which is one circular meter: this is the multi-file queue.
Per-file progress with smoothed speed and time left, retry, and a tick on finish.
A collapsible file upload widget with a shimmer progress bar (indigo while uploading, amber on pause). Expand to see per-file rows with live progress, time remaining, and pause, resume, refresh, and stop controls. Free account required to install; source is free to read.
Showing 26,137–26,160 of 26,785
Showing 26,137–26,160 of 26,785