@molecule/app-share-link-card-solid
Feature · share-link-card · App (browser) · v1.2.4 · Apache-2.0
Card with share URL, copy button, optional QR code placeholder, password toggle
npm install @molecule/app-share-link-card-solidHow it works
@molecule/app-share-link-card-solid is a ready-made share-link-card feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { createSignal } from 'solid-js'
import { render } from 'solid-js/web'
import { MoleculeProvider } from '@molecule/app-solid'
import { ShareLinkCard } from '@molecule/app-share-link-card-solid'
function SharePanel() {
const [passwordEnabled, setPasswordEnabled] = createSignal(false)
return (
<ShareLinkCard
title="Share this project"
description="Anyone with the link can view."
url="https://app.example.com/p/abc123"
passwordProtect={{ enabled: passwordEnabled(), onChange: setPasswordEnabled }}
/>
)
}
render(
() => (
<MoleculeProvider i18n={i18nProvider}>
<SharePanel />
</MoleculeProvider>
),
document.getElementById('root')!,
)Works with: @molecule/app-clipboard, @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid share-link card.
Exports ShareLinkCard — a read-only URL field with a copy button, an
optional title/description header, a QR slot, and an optional
password-protect toggle. It is the Solid counterpart of
@molecule/app-share-link-card-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 { createSignal } from 'solid-js'
import { render } from 'solid-js/web'
import { MoleculeProvider } from '@molecule/app-solid'
import { ShareLinkCard } from '@molecule/app-share-link-card-solid'
function SharePanel() {
const [passwordEnabled, setPasswordEnabled] = createSignal(false)
return (
<ShareLinkCard
title="Share this project"
description="Anyone with the link can view."
url="https://app.example.com/p/abc123"
passwordProtect={{ enabled: passwordEnabled(), onChange: setPasswordEnabled }}
/>
)
}
render(
() => (
<MoleculeProvider i18n={i18nProvider}>
<SharePanel />
</MoleculeProvider>
),
document.getElementById('root')!,
)
Type
feature
Installation
npm install @molecule/app-share-link-card-solid @molecule/app-clipboard @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
ShareLinkCardProps
Props accepted by the ShareLinkCard component.
interface ShareLinkCardProps {
/** Card title. */
title?: JSX.Element
/** Supporting copy under the title. */
description?: JSX.Element
/** The URL users can copy/share. */
url: string
/** Optional QR rendering slot — pass your own QR component from the app side. */
qr?: JSX.Element
/** Whether the QR is visible. Defaults to false. */
showQR?: boolean
/** Password-protect toggle — pass to render the toggle row. */
passwordProtect?: {
/** Whether the toggle is on. */
enabled: boolean
/** Called with the toggle's new boolean state. */
onChange: (enabled: boolean) => void
/** Row label; defaults to a translated "Password protect". */
label?: JSX.Element | (() => JSX.Element)
}
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Functions
ShareLinkCard(props)
Share-link card — bundles a read-only URL field + copy button, an optional QR code slot, and an optional password-protect toggle.
QR rendering is slot-based so apps can bring their own QR library
(@molecule/app-qr-code-solid, or any Solid QR component).
This is the Solid counterpart of @molecule/app-share-link-card-react: the
same props (React names), the same ClassMap tokens, and the same DOM for the
same input.
function ShareLinkCard(props: ShareLinkCardProps): JSX.Element
props— Component props (seeShareLinkCardProps).
Returns: The rendered share-link card.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-clipboard^1.0.1@molecule/app-solid^3.14.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-solid -
solid-js -
QR rendering is slot-based: pass BOTH
qrandshowQR—qralone renders nothing. -
Copy goes through
copyTextWithFallback()from@molecule/app-clipboard: the bonded clipboard provider first, then the legacy copy command. The "Copied!" feedback appears only when a copy actually happened — copy never throws, so a blocked clipboard leaves the label unchanged. -
The password toggle is UI-only: persisting and enforcing the password is the app/server's job.
-
Requires a bonded ClassMap (e.g.
@molecule/app-ui-tailwind) and the bonded i18n provider. Translations:@molecule/app-locales-share-link-card.
Translations
Translation strings are provided by @molecule/app-locales-share-link-card.