185 Pro components and page blocks

Get Pro

Updated

Reject Drop Input

Preview

Customize

Digits
Max length0
Color
Gravity1.0
Medium
Radius12px

Installation

npx shadcn@latest add https://uibrik.com/r/reject-drop-input.json
Adds the files to components/uibrik/reject-drop-input and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/reject-drop-input.

Usage

import { RejectDropInput } from "@/components/uibrik/reject-drop-input/reject-drop-input";​<RejectDropInput  accept="digits"  maxLength={0}  color="#ef4444"  gravity={1}  shake={false}  size="md"  radius={12}  defaultValue=""  onChange={(value) => {}}  onReject={(rejected) => {}}  // allow={(char, soFar) => {}}  // value="…"  // placeholder="…"  // label="…"  // hint="…"/>

Where to use Reject Drop Input

  • Phone and card numbers

    Letters typed into a number field visibly fall out, so the user sees why nothing appeared.

    Pairs with Phone Input and Card Input

  • Amounts

    The amount preset keeps one decimal point and two decimals, and drops the rest.

    Pairs with Amount Pad

  • Codes and handles

    Usernames, promo codes and IDs reject spaces and symbols without a silent swallow.

Props

RejectDropInput
accept
Type "digits" | "letters" | "alphanumeric" | "amount"
"digits"
Which characters the field keeps.
maxLength
Type number
0
Characters past this count are rejected too. 0 for no limit.
color
Type string
"#ef4444"
Colour of rejected characters and the hint.
gravity
Type number
1
How hard rejected characters fall.
shake
Type boolean
false
Nudge the field sideways on a rejection.
size
Type "sm" | "md" | "lg"
"md"
Height, padding and text size.
radius
Type number
12
Corner radius.
allow
Type (char: string, soFar: string) => boolean
–
Custom rule; return true to keep the character. Overrides accept.
value
Type string
–
Controlled value.
defaultValue
Type string
""
Starting value when uncontrolled.
onChange
Type (value: string) => void
–
Called with the cleaned value.
onReject
Type (rejected: string) => void
–
Called with the characters that were thrown out.
placeholder
Type string
–
Placeholder text.
label
Type string
"Number"
Accessible name for the field.
hint
Type string
–
Shown under the field after a rejection. Defaults to the preset's hint.
className
Type string
–
Classes for the wrapper.