@molecule/app-secret-row-solid

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-solid

npm · Source on GitHub

How it works

@molecule/app-secret-row-solid 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 { SecretRow } from '@molecule/app-secret-row-solid'

export function VaultRow() {
  return (
    <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)}
    />
  )
}

Works with: @molecule/app-clipboard, @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid 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 Solid 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.ts JSDoc, not this file.

Quick Start

import { SecretRow } from '@molecule/app-secret-row-solid'

export function VaultRow() {
  return (
    <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)}
    />
  )
}

Type

feature

Installation

npm install @molecule/app-secret-row-solid @molecule/app-clipboard @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

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 Solid JSX element). */
  version?: JSX.Element
  /**
   * 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?: JSX.Element
  /** Additional description (e.g. "Stripe API key"). */
  description?: JSX.Element
}

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
}

Functions

SecretRow(props)

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.

This is the Solid counterpart of @molecule/app-secret-row-react: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

function SecretRow(props: SecretRowProps): JSX.Element
  • props — Component props (see SecretRowProps).

Returns: The rendered secret row.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-clipboard ^1.0.1
  • @molecule/app-solid ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.4.0
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-clipboard

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • Rotation status renders from two fields: daysUntilRotation < 0 shows an "Expired" tag, daysUntilRotation >= 0 shows a "Rotate in {n}d" countdown, and lastRotatedAt (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} — pass version="2", not "v2".

  • Delete fires immediately — add your own confirmation dialog before calling a destructive API.

  • Throws unless inside a Solid 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.