Copy and reveal
Copy or deliberately reveal sensitive text with accessible text or icon actions.
Default
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let copyRevealExample =
fveField {
fveLabel {
_for "demo-token"
"Demo API token"
}
fveCopyReveal {
_id "demo-token"
_value "fve_demo_84fK2s"
}
}This example also uses Field. See their Installation sections for any additional setup.
On this page
Installation
Copy this component and its required dependencies into the consumer-owned Components project.
dotnet fve add copy-reveal --config src/Acme.Components/fve.jsonAdd to src/Acme.Web/js/app.js once, alongside your other component imports:
import '../../Acme.Components/Components/Assets/button.js';
import '../../Acme.Components/Components/Assets/copy-reveal.js';The CLI resolves dependencies and preserves consumer-authored files. See Installation for project initialization, Tailwind, the shared runtime, and building/loading your app entry.
Usage
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let copyRevealExample =
fveField {
fveLabel {
_for "demo-token"
"Demo API token"
}
fveCopyReveal {
_id "demo-token"
_value "fve_demo_84fK2s"
}
}Icon actions
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let iconCopyRevealExample =
fveField {
fveLabel {
_for "icon-demo-token"
"Icon action demo token"
}
fveCopyReveal {
_id "icon-demo-token"
_value "fve_demo_icon"
_iconButtons true
}
}This example also uses Field. See their Installation sections for any additional setup.
Initially revealed
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let revealedCopyRevealExample =
fveField {
fveLabel {
_for "revealed-demo-token"
"Revealed demo token"
}
fveCopyReveal {
_id "revealed-demo-token"
_value "fve_demo_safe"
_revealed true
}
}This example also uses Field. See their Installation sections for any additional setup.
API reference
module CopyRevealDsl =
val fveCopyReveal : ComponentElementBuilder
module CopyRevealAttributes =
val Html._revealed.Static : value:bool -> HtmlAttribute
val Html._iconButtons.Static : value:bool -> HtmlAttribute