Skip to content

ReadonlyInput

A lightweight read-only input component with copy and reveal functionality.

••••••••••••
••••••••••••
••••••••••••
// Import component
import { ReadonlyInput } from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/readonly_input.css';
return (
<ReadonlyInput
value="supersecretpassword"
copyable
revealable
masked
/>
);
// Import components
import {
Icon,
ReadonlyInput,
} from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/icon.css';
import '@fintech-sandpit/ui/style/components/readonly_input.css';
// Import icons
import { faLock } from '@fortawesome/free-solid-svg-icons';
return (
<ReadonlyInput
copyable
revealable
masked
>
<div className="flex items-center gap-2">
<Icon
as={faLock}
boxSize="1em"
/>
<span>supersecretpassword</span>
</div>
</ReadonlyInput>
);
// Import components
import {
Field,
ReadonlyInput,
} from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/field.css';
import '@fintech-sandpit/ui/style/components/readonly_input.css';
return (
<Field.Root
label="Password"
orientation="horizontal"
>
<ReadonlyInput
value="supersecretpassword"
copyable
revealable
masked
/>
</Field.Root>
);
NameTypeDefaultDescription
valuestring | number | null—The value to display
sizeFieldSizemdThe size of the component
maskedbooleanfalseWhether the value should be masked
copyablebooleanfalseWhether the value should be copyable
revealablebooleanfalseWhether the value should be revealable
Slot nameDescription
defaultThe content to display when the value is not masked
NameTypeDescription
onCopy() => voidEvent handler for when the value is copied
onReveal(state: boolean) => voidEvent handler for when the value is revealed or hidden
type FieldSize = 'sm' | 'md' | 'lg'