@molecule/app-share-link-card-vue
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-vueHow it works
@molecule/app-share-link-card-vue 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 { createApp, defineComponent, h, ref } from 'vue'
import { moleculePlugin } from '@molecule/app-vue'
import { ShareLinkCard } from '@molecule/app-share-link-card-vue'
const SharePanel = defineComponent({
setup() {
const passwordEnabled = ref(false)
return () =>
h(ShareLinkCard, {
title: 'Share this project',
description: 'Anyone with the link can view.',
url: 'https://app.example.com/p/abc123',
passwordProtect: {
enabled: passwordEnabled.value,
onChange: (enabled: boolean) => (passwordEnabled.value = enabled),
},
})
},
})
const app = createApp(SharePanel)
app.use(moleculePlugin, { i18n: i18nProvider })
app.mount('#app')Works with: @molecule/app-clipboard, @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue 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 Vue 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 { createApp, defineComponent, h, ref } from 'vue'
import { moleculePlugin } from '@molecule/app-vue'
import { ShareLinkCard } from '@molecule/app-share-link-card-vue'
const SharePanel = defineComponent({
setup() {
const passwordEnabled = ref(false)
return () =>
h(ShareLinkCard, {
title: 'Share this project',
description: 'Anyone with the link can view.',
url: 'https://app.example.com/p/abc123',
passwordProtect: {
enabled: passwordEnabled.value,
onChange: (enabled: boolean) => (passwordEnabled.value = enabled),
},
})
},
})
const app = createApp(SharePanel)
app.use(moleculePlugin, { i18n: i18nProvider })
app.mount('#app')
Type
feature
Installation
npm install @molecule/app-share-link-card-vue @molecule/app-clipboard @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
API
Interfaces
ShareLinkCardProps
Props accepted by the ShareLinkCard component.
interface ShareLinkCardProps {
/** Card title. */
title?: VNodeChild
/** Supporting copy under the title. */
description?: VNodeChild
/** The URL users can copy/share. */
url: string
/** Optional QR rendering slot — pass your own QR component from the app side. */
qr?: VNodeChild
/** 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 (a node, or a same-named slot); defaults to a translated "Password protect". */
label?: VNodeChild
}
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Constants
ShareLinkCard
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-vue, qrcode.vue, etc.).
const ShareLinkCard: DefineComponent<
ExtractPropTypes<{
title: null
description: null
url: { type: StringConstructor; required: true }
qr: null
showQR: { type: BooleanConstructor; default: boolean }
passwordProtect: {
type: PropType<NonNullable<ShareLinkCardProps['passwordProtect']>>
default: undefined
}
className: StringConstructor
dataMolId: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
title: null
description: null
url: { type: StringConstructor; required: true }
qr: null
showQR: { type: BooleanConstructor; default: boolean }
passwordProtect: {
type: PropType<NonNullable<ShareLinkCardProps['passwordProtect']>>
default: undefined
}
className: StringConstructor
dataMolId: StringConstructor
}>
> &
Readonly<{}>,
{
passwordProtect: { enabled: boolean; onChange: (enabled: boolean) => void; label?: VNodeChild }
showQR: boolean
},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeShareLinkCardProps).
Returns: The share-link card component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-clipboard^1.0.1@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.5.0
Runtime Dependencies
-
@molecule/app-clipboard -
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
QR rendering is slot-based: pass BOTH
qrandshowQR—qralone renders nothing.qrmay be a prop value or the same-named slot. -
The title, description and password label are node-valued; each may be passed as a prop or as the same-named slot.
-
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.