@molecule/app-secret-row-vue
Feature · secret-row · App (browser) · v1.2.1 · Apache-2.0
Secret/credential row: masked value + reveal/copy + rotation status + version
npm install @molecule/app-secret-row-vueHow it works
@molecule/app-secret-row-vue is a ready-made secret-row 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 } from 'vue'
import { SecretRow } from '@molecule/app-secret-row-vue'
const App = defineComponent({
setup() {
return () =>
h(SecretRow, {
secret: {
id: 'sk-1',
key: 'STRIPE_SECRET_KEY',
value: 'sk_live_abc123',
description: 'Stripe API key',
daysUntilRotation: 14,
},
onRotate: (s) => rotate(s.id),
onDelete: (s) => remove(s.id),
})
},
})
createApp(App).mount('#app')Works with: @molecule/app-clipboard, @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue vault-style secret / credential row.
Exports <SecretRow> and the SecretRowData type ({ id, key, value, version?, daysUntilRotation?, lastRotatedAt?, description? }). Renders
key + masked value with Show/Hide and Copy buttons, an optional rotation
status (an "Expired" tag / "Rotate in {n}d" countdown / "Last rotated
{value}" note), plus optional Rotate / Delete buttons (shown only when
onRotate / onDelete are passed). maskChar customizes the mask glyph
(default '•'). It is the Vue counterpart of
@molecule/app-secret-row-react: the same props (React names) and the same
DOM for the same input.
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 } from 'vue'
import { SecretRow } from '@molecule/app-secret-row-vue'
const App = defineComponent({
setup() {
return () =>
h(SecretRow, {
secret: {
id: 'sk-1',
key: 'STRIPE_SECRET_KEY',
value: 'sk_live_abc123',
description: 'Stripe API key',
daysUntilRotation: 14,
},
onRotate: (s) => rotate(s.id),
onDelete: (s) => remove(s.id),
})
},
})
createApp(App).mount('#app')
Type
feature
Installation
npm install @molecule/app-secret-row-vue @molecule/app-clipboard @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
API
Interfaces
SecretRowData
Data model for a single secret/credential entry in a vault UI.
interface SecretRowData {
/** Stable identity of the secret. */
id: string
/** The credential's name (`STRIPE_SECRET_KEY`). */
key: string
/** Current value (revealed only after the user clicks "Show"). */
value: string
/** Version number / label (React's `ReactNode`: any Vue node child). */
version?: VNodeChild
/**
* Days until the secret should be rotated. A negative value renders an
* "Expired" tag; zero or a positive value renders a "Rotate in {n}d"
* countdown.
*/
daysUntilRotation?: number
/** Last-rotation timestamp (ISO string or any node); rendered as "Last rotated {value}". */
lastRotatedAt?: VNodeChild
/** Additional description (e.g. "Stripe API key"). */
description?: VNodeChild
}
SecretRowProps
Props accepted by the SecretRow component.
interface SecretRowProps {
/** The secret to display. */
secret: SecretRowData
/** Called when the user clicks Rotate. */
onRotate?: (secret: SecretRowData) => void
/** Called when the user clicks Delete. */
onDelete?: (secret: SecretRowData) => void
/** Mask character for the hidden value. Defaults to `'•'`. */
maskChar?: string
/** Extra classes. */
className?: string
}
Constants
SecretRow
Secret / credential row for vault UIs. Masked by default; the user toggles
reveal, can copy to clipboard, sees an "Expired" tag when
daysUntilRotation is negative or a "Rotate in {n}d" countdown when it is
zero/positive, and a "Last rotated {value}" note when lastRotatedAt is
set. The Rotate / Delete buttons render only when their handler is passed.
Copying goes through copyTextWithFallback (@molecule/app-clipboard),
which never throws — the Copy button shows no feedback when the copy was
blocked, exactly like React.
const SecretRow: DefineComponent<
ExtractPropTypes<{
secret: { type: PropType<SecretRowData>; required: true }
onRotate: { type: PropType<(secret: SecretRowData) => void>; default: undefined }
onDelete: { type: PropType<(secret: SecretRowData) => void>; default: undefined }
maskChar: { type: StringConstructor; default: string }
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
secret: { type: PropType<SecretRowData>; required: true }
onRotate: { type: PropType<(secret: SecretRowData) => void>; default: undefined }
onDelete: { type: PropType<(secret: SecretRowData) => void>; default: undefined }
maskChar: { type: StringConstructor; default: string }
className: StringConstructor
}>
> &
Readonly<{}>,
{
onRotate: (secret: SecretRowData) => void
onDelete: (secret: SecretRowData) => void
maskChar: string
},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeSecretRowPropsin./types.js).
Returns: The secret row component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-clipboard^1.0.1@molecule/app-ui^1.4.0@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.5.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-clipboard -
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
Rotation status renders from two fields:
daysUntilRotation < 0shows an "Expired" tag,daysUntilRotation >= 0shows a "Rotate in {n}d" countdown, andlastRotatedAt(when set) renders a "Last rotated {value}" note. Omit a field to hide its chip. -
Copying goes through
copyTextWithFallback(@molecule/app-clipboard): the Clipboard API through the bonded clipboard provider when one is wired, the legacy copy command otherwise — so it also works on plain-HTTP pages and inside iframes. The function never throws; when the copy is blocked the button shows no feedback. -
The version chip renders as
v{version}— passversion="2", not "v2". -
Delete fires immediately — add your own confirmation dialog before calling a destructive API.
-
Throws unless inside a Vue app with the binding's theme and i18n providers and a bonded ClassMap. Translations:
@molecule/app-locales-secret-row.
Translations
Translation strings are provided by @molecule/app-locales-secret-row.