@molecule/app-copy-link-field-solid
Feature · copy-link-field · App (browser) · v1.2.2 · Apache-2.0
Read-only input + copy-to-clipboard button for share links, API keys, webhook URLs
npm install @molecule/app-copy-link-field-solidHow it works
@molecule/app-copy-link-field-solid is a ready-made copy-link-field feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { render } from 'solid-js/web'
import { MoleculeProvider } from '@molecule/app-solid'
import { CopyLinkField } from '@molecule/app-copy-link-field-solid'
render(
() => (
<MoleculeProvider i18n={i18nProvider}>
<CopyLinkField
label="Share link"
value="https://example.com/invite/abc123"
onCopy={() => console.log('copied')}
feedbackMs={2000}
/>
</MoleculeProvider>,
),
document.getElementById('root')!,
)Works with: @molecule/app-clipboard, @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid copy-link field.
Exports <CopyLinkField> — read-only input + copy-to-clipboard button with
"Copied!" feedback. Solid counterpart of
@molecule/app-copy-link-field-react: the same props (React names), the
same DOM for the same input, the same ClassMap tokens and i18n keys.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { render } from 'solid-js/web'
import { MoleculeProvider } from '@molecule/app-solid'
import { CopyLinkField } from '@molecule/app-copy-link-field-solid'
render(
() => (
<MoleculeProvider i18n={i18nProvider}>
<CopyLinkField
label="Share link"
value="https://example.com/invite/abc123"
onCopy={() => console.log('copied')}
feedbackMs={2000}
/>
</MoleculeProvider>,
),
document.getElementById('root')!,
)
Type
feature
Installation
npm install @molecule/app-copy-link-field-solid @molecule/app-clipboard @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
CopyLinkFieldProps
Props for the CopyLinkField component.
interface CopyLinkFieldProps {
/** Value to display (and copy on click). */
value: string
/** Optional label above the field. */
label?: string
/** Called after a successful copy. */
onCopy?: () => void
/** How long the "Copied!" state lingers (ms). Defaults to 1500. */
feedbackMs?: number
/** Size of the copy button. Defaults to `'sm'`. */
size?: 'sm' | 'md'
/** Extra classes. */
className?: string
}
Functions
CopyLinkField(props)
Read-only input + copy-to-clipboard button. Common in share-link panels, API-key cards, webhook URLs.
The copy button copies through @molecule/app-clipboard
(copyTextWithFallback — the bonded clipboard provider first, then a
legacy copy fallback — which resolves false instead of throwing), so it
works on insecure (non-HTTPS) contexts too; the copied feedback shows and
onCopy fires only when the copy succeeded. The input is read-only and
selects its content on focus, so manual Ctrl/Cmd+C still works as the
fallback. Labels use copyLink.* i18n keys.
The input's value is written through Solid's attr: namespace (attr:value)
the same way @molecule/app-ui-solid's Input does: React carries both the
value attribute and the live property, and the attribute is the part a
plain value={…} JSX prop never writes.
This is the Solid counterpart of @molecule/app-copy-link-field-react: the
same props (React names), the same ClassMap tokens, and the same DOM for the
same input.
function CopyLinkField(props: CopyLinkFieldProps): JSX.Element
props— Component props (seeCopyLinkFieldProps).
Returns: The rendered copy-link field.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-clipboard^1.0.1@molecule/app-solid^3.6.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-clipboard@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
The copy button copies through @molecule/app-clipboard
(copyTextWithFallback — the bonded clipboard provider first, then a
legacy copy fallback — which resolves false instead of throwing), so it
works on insecure (non-HTTPS) contexts too; the copied feedback shows and
onCopy fires only when the copy succeeded. The input is read-only and
selects its content on focus, so manual Ctrl/Cmd+C still works as the
fallback. Labels use copyLink.* i18n keys (companion bond:
@molecule/app-locales-copy-link-field), read through the binding's
useTranslation() — the bonded @molecule/app-i18n provider satisfies it,
so the static t works wherever the provider is bonded. Styling routes
through ClassMap tokens (cm.stack(1), cm.flex, cm.input(),
cm.flex1) and requires a bonded ClassMap (e.g.
@molecule/app-ui-tailwind).
Translations
Translation strings are provided by @molecule/app-locales-copy-link-field.