Hash
An id, a commit or a key, shortened so it fits, with the whole value on hover and one press to copy it.
import { Hash, HashSkeleton } from '@sypnia/ui/react'
Ids in a sentence
Hover to see the whole value; press the icon to copy it.
Commit 9f86d08…9f86d081884c7d659a2feaa0c55ad015a3bf4f1b deployed to production.
Request req_01HZX8…req_01HZX8Q2V7K3M9
Code
import { Hash } from '@sypnia/ui/react';
// Shortened to fit, whole on hover and for screen readers, and one press to copy.
export default function Ids() {
return (
<div className="sy-stack">
<p>Commit <Hash value="9f86d081884c7d659a2feaa0c55ad015a3bf4f1b" label="commit" /> deployed to production.</p>
<p>Request <Hash value="req_01HZX8Q2V7K3M9" length={10} label="request id" /></p>
</div>
);
} Skeleton
The real piece and its skeleton: the same box, so nothing moves when the data arrives.
Commit 9f86d08…9f86d081884c7d659a2feaa0c55ad015 · Commit
Code
import { Hash, HashSkeleton } from '@sypnia/ui/react';
export default function Skeleton() {
return <p className="sy-row">Commit <Hash value="9f86d081884c7d659a2feaa0c55ad015" label="commit" /> · Commit <HashSkeleton /></p>;
} When to use it
Use it when
- Long ids in a sentence, a list or a table cell.
Do not use it when
- The value is secret: CopyField with
secret.
For everyone
- Screen readers hear the whole value, not the shortened one.
- Copy names what it copies: «Copy commit».
Props
| Hash | Type | Default |
|---|---|---|
valuerequired | string | |
copy | boolean | true |
label | string | |
length | number | 7 |