HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Secret

Conceals sensitive content with a blur, mask, or noise effect, revealing it on user interaction.

123-45-6789

Usage

forge-secret conceals its default-slot content until a user reveals it, through open, variant (blur, masked, or noise), block, buttonPosition, showOnHover, and name. Use it for sensitive values a user might not want visible by default, like an account number or password, in a context where someone else could be looking at the screen.

Not a security control

Concealed content is still present in the DOM and can be read from the page source — forge-secret only prevents visual exposure. It’s useful for shoulder-surfing and accidental-glance protection, but it does not protect against a determined user. The only way to truly secure sensitive information is to not send it to the client at all.

Rules

Do
Use a secret for a value someone might not want visible by default, like an account number.Set name to group related secrets so revealing one conceals the others.Set block for a secret that wraps a larger piece of content, like a paragraph or image.
Don't
Don't treat a secret as a security boundary — the concealed content is still in the DOM and page source.Don't use a secret for content that's fine to always show — it adds an interaction step with no benefit.

Basic usage

Content stays concealed until a user clicks the reveal button.

A secret concealing inline content until revealed.

Named groups

Give multiple secrets the same name and they behave like a radio group — revealing one conceals any other open secret sharing that name.

Secrets sharing a name, so revealing one conceals the others.

Block layout

Set block for a secret that wraps a larger piece of content, like a paragraph or image, instead of displaying inline with surrounding text.

A block secret concealing a larger piece of content.

A component that conceals content with a blur or dot mask, revealing it on user interaction.

import "@tylertech/forge/secret";
Properties
PropertyAttributeTypeDefaultDescription
openopenbooleanfalseWhether the secret content is visible.
variantvariantSecretVariant'blur'The style applied to hidden content when the secret is set to inline. Possible values are blur, masked, and noise.
maskmaskstring''The mask pattern to use with the masked variant. When empty the slotted text content is used as the mask.
maskCharactermask-characterstring'●'The character to replace characters with in the masked variant.
unmaskedCharactersunmasked-charactersstring''Characters that will not be replaced by the mask character in the masked variant.
blockblockbooleanfalseWhether the secret content should be displayed as a block element instead of inline with text.
buttonPositionbutton-positionSecretButtonPosition'end'The position of the button when the secret is set to inline. Possible values are start and end.
showOnHovershow-on-hoverbooleanfalseWhether to reveal content on hover/focus in addition to clicks.
namenamestring''When set, secrets with the same name will close when another secret with that name is opened.
Events
NameTypeDescription
toggleToggleEventDispatched when the secret opens or closes.
Slots
NameDescription
(default)Default slot for the secret content.
close-iconAn icon that is shown when the secret is open, indicating it can be closed.
open-iconAn icon that is shown when the secret is closed, indicating it can be opened.
labelText content that appears in the tooltip attached to the button or as the button text when set to block.
CSS Parts
NameDescription
::part(root)The root container.
::part(content)The content container.
::part(button)The toggle button element.
::part(text-button)The toggle button element when the secret is set to block.
CSS Custom Properties
NameDescription
--forge-secret-blurThe radius of the blur effect.
--forge-secret-button-backgroundThe background color of the button.
--forge-secret-button-colorThe text and icon color of the button.
--forge-secret-button-shapeThe button's border radius.
--forge-secret-button-paddingThe inline padding around the button or inline and block padding around the text button.
--forge-secret-button-sizeThe button's width and height.
--forge-secret-icon-sizeThe icon's size.
--forge-secret-text-button-shapeThe text button's border radius.
--forge-secret-text-decoration-lineThe decoration line applied to open inline content.
--forge-secret-text-decoration-styleThe style of the text decoration line.
--forge-secret-text-decoration-colorThe color of the text decoration line.
--forge-secret-text-underline-offsetThe spacing between the inline content and the text decoration line.
--forge-secret-transition-durationThe duration of transitions.
--forge-secret-transition-easingThe timing function of transitions.

Roles and states

forge-secret uses role="group" to semantically group its content with the reveal button. The button carries aria-expanded to convey whether the content is currently visible, and aria-controls to associate it with the group. When content is revealed, that change is announced to screen readers through a live region. While concealed, the content is marked inert so it can’t receive keyboard focus or be read by assistive technology.

Keyboard interaction

The reveal button is focusable and can be toggled with Enter or Space. Pressing Escape while a secret is open closes it. Clicking the concealed content itself also reveals it and moves focus to the button.

Loading Forge chat…