Clipboard copy for lit-material: copyText() with a fallback for non-secure pages, a copy button, and a read-only value with copy (and optional masking), and a newly created secret shown once.
6.4 KB gzipped
@lit-material/clipboard 1.8.0
Renders on the server
Example
New secret
A token, API key or recovery code shown once, right after it was created: the value with a copy button and a warning that it won't be shown again. Screen readers hear it appear, and focus lands on the value. A "Done" button in the actions slot drops it from the page.
Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide
API
<lit-material-new-secret>
A secret shown once, right after it was created: an access token, an API
key, a recovery code. The value with a copy button, and a warning that it
can't be shown again. Put a "Done" button in the actions slot that drops
the element (and the secret) from the page.
Properties
Property
Attribute
Type
Default
Description
value
value
string
""
The secret.
label
label
string
""
What it is, e.g. "Access token \"ci\"": the heading and the value's accessible name.
Events
Event
Description
copy
Bubbles from the copy button; detail is { text, ok }.
Slots
Slot
Description
warning
Replaces the default warning text.
actions
Buttons under the value, e.g. "Done".
CSS parts
Part
Description
container
The outlined box.
value
The lit-material-clipboard-copy holding the secret.