••••••••••••
••••••••••••
••••••••••••
A lightweight read-only input component with copy and reveal functionality.
value prop// Import componentimport { 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 />);<script setup lang="ts">// Import componentimport { ReadonlyInput } from '@fintech-sandpit/ui/vue';// Import styles (optional)import '@fintech-sandpit/ui/style/components/readonly_input.css';</script>
<template> <ReadonlyInput value="supersecretpassword" copyable revealable masked /></template>// Import componentsimport { 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 iconsimport { 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>);<script setup lang="ts">// Import componentsimport { Icon, ReadonlyInput,} from '@fintech-sandpit/ui/vue';// Import styles (optional)import '@fintech-sandpit/ui/style/components/icon.css';import '@fintech-sandpit/ui/style/components/readonly_input.css';// Import iconsimport { faLock } from '@fortawesome/free-solid-svg-icons';</script>
<template> <ReadonlyInput copyable revealable masked > <div class="flex items-center gap-2"> <Icon :as="faLock" boxSize="1em" />
<span>supersecretpassword</span> </div> </ReadonlyInput></template>Field component// Import componentsimport { 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>);<script setup lang="ts">// Import componentsimport { Field, ReadonlyInput,} from '@fintech-sandpit/ui/vue';// Import styles (optional)import '@fintech-sandpit/ui/style/components/field.css';import '@fintech-sandpit/ui/style/components/readonly_input.css';</script>
<template> <Field.Root label="Password" orientation="horizontal" > <ReadonlyInput value="supersecretpassword" copyable revealable masked /> </Field.Root></template>| Name | Type | Default | Description |
|---|---|---|---|
value | string | number | null | — | The value to display |
size | FieldSize | md | The size of the component |
masked | boolean | false | Whether the value should be masked |
copyable | boolean | false | Whether the value should be copyable |
revealable | boolean | false | Whether the value should be revealable |
| Slot name | Description |
|---|---|
default | The content to display when the value is not masked |
| Name | Type | Description |
|---|---|---|
onCopy | () => void | Event handler for when the value is copied |
onReveal | (state: boolean) => void | Event handler for when the value is revealed or hidden |
| Name | Type | Description |
|---|---|---|
copy | () => void | Event handler for when the value is copied |
reveal | (state: boolean) => void | Event handler for when the value is revealed or hidden |
type FieldSize = 'sm' | 'md' | 'lg'