Swaps
avail-widgets/swapsFreeComponent
Deprecated: use Nexus Widget instead. Legacy swap tokens across chains component.
Install it
npx shadcn@latest add https://elements.nexus.availproject.org/r/swaps.jsonSource
1import { type FC, useRef } from "react";23interface AmountInputProps {4 amount?: string;5 onChange?: (value: string) => void;6 onFocus?: () => void;7 disabled?: boolean;8}910const AmountInput: FC<AmountInputProps> = ({11 amount,12 onChange,13 onFocus,14 disabled,15}) => {16 const inputRef = useRef<HTMLInputElement>(null);17 const mirrorRef = useRef<HTMLDivElement>(null);1819 return (20 <div className="relative flex items-start gap-2 text-4xl font-medium transition-all duration-150 ease-out w-full">21 <div22 ref={mirrorRef}23 className="absolute invisible pointer-events-none text-4xl font-medium whitespace-pre"24 style={{25 fontVariantNumeric: "proportional-nums",26 }}27 >28 {amount || "0"}29 </div>3031 <input32 ref={inputRef}33 type="text"34 inputMode="decimal"35 placeholder="0"36 value={amount}37 onChange={(e) => {38 onChange?.(e.target.value);39 }}40 onFocus={onFocus}41 maxLength={18}42 autoFocus43 className="bg-transparent w-full text-foreground text-4xl font-medium outline-none transition-all duration-150 placeholder-muted-foreground proportional-nums disabled:opacity-50"44 disabled={disabled}45 />46 <div className="absolute -inset-1 -z-10 blur-sm pointer-events-none opacity-0" />47 </div>48 );49};5051export default AmountInput;
What it pulls in
npm packages
Other registry items
Files it writes
More from avail-widgets
All 27 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | avail-widgets | Components | Free | 2 deps | |
| All Elementsall | avail-widgets | Components | Free | no deps | |
| Animated Spinneranimated-spinner | avail-widgets | Components | Free | no deps | |
| Badgebadge | avail-widgets | Components | Free | 2 deps | |
| Bridge Depositbridge-deposit | avail-widgets | Components | Free | 3 deps · 32 files | |
| Buttonbutton | avail-widgets | Components | Free | 2 deps | |
| Cardcard | avail-widgets | Components | Free | no deps | |
| Checkboxcheckbox | avail-widgets | Components | Free | 2 deps |
