Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Buttons

  • Button
  • ShimmerButton
  • InteractiveHoverButton
  • RainbowButton
  • PulsatingButton
  • RippleButton
  • ButtonGroup
  • SocialButton

Basic Inputs

  • Input
  • Textarea
  • CellEditor
  • Select
  • Checkbox
  • CheckboxGroup
  • Radio
  • Switch
  • Toggle
  • Segmented
  • Slider
  • NumberField
  • ElasticSlider

Advanced Inputs

  • MathTextarea
  • QuestionEditor
  • QuestionAnswer
  • MathField
  • SecretField
  • PasswordGenerator
  • Combobox
  • RemoteSelect
  • Listbox
  • Mentions
  • InputOTP
  • Rating
  • Upload
  • RegionSelect
  • ImageCropper
  • ScopeMatrix
  • Transfer
  • Cascader
  • TreeSelect
  • RegionCascader
  • CountrySelect
  • MarkdownEditor
  • Novel editor
  • RichTextEditor
  • CodeEditor
  • IssueReporter
  • ColorPicker
  • ColorField
  • ColorSwatchPicker
  • Choicebox
  • EmojiPicker
  • VoiceRecord
  • IconPicker
  • InspectorPanel

Date and Time

  • Calendar
  • DatePicker
  • DateTimePicker
  • DateRangePicker
  • TimePicker
  • TimeField

Form Frameworks

  • Form
  • ModalForm / DrawerForm
  • ProForm
  • StepsForm
  • LoginForm
  • AuthPanel
  • ClickCaptcha
  • Label
  • Field
  • SearchForm

SecretField

secret-field

Masks sensitive values while supporting reveal and copy actions.

Usage

Basic usage

The default mask is sk-xxx...xxxx. Click on the eyes to reveal them and click on the copy to get the original value.

sk-han…ab78
tsx
<SecretField value="sk-hanhub-7f3a9c2e1b8d4056af12cd34ef56ab78" />

Full mask

maskStrategy="full" is completely hidden and does not reveal the head and tail structure.

••••••••••••••••
tsx
<SecretField value={apiKey} maskStrategy="full" />

Read only and cannot be copied

Remove the interactive stroke, hide the copy button, and purely display the scene.

sk-han…ab78
tsx
<SecretField value={apiKey} readOnly copyable={false} />

Tail Action Slot

actions slot has a revoke/reset button, side by side with display/copy.

sk-han…ab78
tsx
<SecretField
  value={apiKey}
  actions={
    <button type="button" className="px-1.5 text-xs text-danger">
      Revoked
    </button>
  }
/>

Size

size="sm" fits within dense table rows.

sk-han…ab78
tsx
<SecretField value={apiKey} size="sm" />

When to use

Use SecretField to display an existing API key, token, or secret with masking, reveal, copy, and optional reset or revoke actions. It is for viewing and copying stored secrets, not entering them. Use Input with type="password" for password entry.

For searchable option selection rather than secret display, use Combobox.

Import

ts
import { SecretField, maskSecret } from "@hulianui/ui"

Props

NameTypeDefaultDescription
value *string-Original unmasked secret.
revealedboolean-Controlled reveal state; omit for internal state.
maskStrategy"full"|"prefix-suffix""prefix-suffix"full masks everything; prefix-suffix retains the beginning and end.
copyablebooleantrueWhether to display the copy button
readOnlybooleanfalseRead-only appearance (remove interactive strokes)
size"sm"|"md""md"-
classNamestring--

Events

EventTypeDescription
onRevealedChange(revealed: boolean) => voidCalled when reveal state changes; use for controlled state.
onCopy(value: string) => voidCalled with the original value after copying.

Slots

SlotTypeDescription
actionsReactNodeTail action slot (reset/revocation, etc.)

The exported maskSecret(value, strategy) helper generates a masked string without rendering the component.

Example

tsx
<SecretField value={apiKey} maskStrategy="prefix-suffix" />

Full masking, no copy action, and controlled reveal:

tsx
const [revealed, setRevealed] = useState(false);
<SecretField
  value={apiKey}
  maskStrategy="full"
  copyable={false}
  revealed={revealed}
  onRevealedChange={setRevealed}
/>

Usage guidelines

  • value must be the original plaintext secret. Masking is only a presentation layer, and the original remains available for copying; never pass an already-masked string.
  • Omit revealed for internal state. For externally coordinated reveal behavior, pass both revealed and onRevealedChange.
  • copyable defaults to true. Set copyable={false} when policy forbids clipboard access.

Related

Show, hide, copy, and copied labels follow ConfigProvider.
Combobox · Listbox · Mentions · InputOTP · Rating · Upload

Playground

sk-han…ab78
<SecretField value={apiKey} maskStrategy="prefix-suffix" />
PreviousNumberFieldFormsNextPasswordGenerator

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related
  • Playground