@molecule/app-slide-thumbnail-vue

Feature · slide-thumbnail · App (browser) · v1.1.2 · Apache-2.0

Slide thumbnail tile for presentation editors / slideshow navigators

npm install @molecule/app-slide-thumbnail-vue

npm · Source on GitHub

How it works

@molecule/app-slide-thumbnail-vue is a ready-made slide-thumbnail feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { defineComponent, h } from 'vue'
import { SlideThumbnail } from '@molecule/app-slide-thumbnail-vue'

interface Slide {
  id: string
  title: string
}

export const SlideStrip = defineComponent({
  props: { slides: Array as () => Slide[], activeIndex: Number },
  emits: ['select'],
  setup(props, { emit }) {
    return () =>
      h(
        'div',
        { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
        props.slides.map((slide, i) =>
          h(
            SlideThumbnail,
            {
              key: slide.id,
              index: i + 1,
              active: i === props.activeIndex,
              onClick: () => emit('select', i),
              width: 160,
            },
            { default: () => [h('span', slide.title)] },
          ),
        ),
      )
  },
})

Works with: @molecule/app-i18n, @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue

Reference

Vue slide thumbnail tile for presentation editors / slideshow navigators. Renders a fixed-width clickable tile with an index badge and an "active" outline; the app supplies the scaled-down slide preview as the default slot.

Vue counterpart of @molecule/app-slide-thumbnail-react: the same props (React names), the same DOM for the same input, and the same ClassMap tokens. Apps switch framework by changing only the package name in their imports.

Props: index (1-based, required), active, onClick, aspect ('16/9' | '4/3' | '1/1', default '16/9'), width (px, default 160), className, and the default slot (or a children prop).

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 { defineComponent, h } from 'vue'
import { SlideThumbnail } from '@molecule/app-slide-thumbnail-vue'

interface Slide {
  id: string
  title: string
}

export const SlideStrip = defineComponent({
  props: { slides: Array as () => Slide[], activeIndex: Number },
  emits: ['select'],
  setup(props, { emit }) {
    return () =>
      h(
        'div',
        { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
        props.slides.map((slide, i) =>
          h(
            SlideThumbnail,
            {
              key: slide.id,
              index: i + 1,
              active: i === props.activeIndex,
              onClick: () => emit('select', i),
              width: 160,
            },
            { default: () => [h('span', slide.title)] },
          ),
        ),
      )
  },
})

Type

feature

Installation

npm install @molecule/app-slide-thumbnail-vue @molecule/app-i18n @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

SlideThumbnailProps

Props for the SlideThumbnail component.

interface SlideThumbnailProps {
  /** Slide index (1-based). */
  index: number
  /**
   * Live preview content (rendered scaled-down) — the DEFAULT slot. Passed as
   * a slot or as the same-named prop; both work.
   */
  children?: VNodeChild
  /** Whether the thumbnail represents the active slide. */
  active?: boolean
  /** Click handler; receives the DOM click event (React's `onClick`). */
  onClick?: (event: MouseEvent) => void
  /** Optional aspect ratio (defaults to 16/9). */
  aspect?: '16/9' | '4/3' | '1/1'
  /** Width in pixels. Defaults to 160. */
  width?: number
  /** Extra classes. */
  className?: string
}

Constants

SlideThumbnail

Slide thumbnail tile for presentation editors / slideshow navigators. Apps render the live scaled-down preview as the default slot; this component provides the surrounding chrome (active outline + index label).

const SlideThumbnail: DefineComponent<
  ExtractPropTypes<{
    index: { type: NumberConstructor; required: true }
    children: null
    active: { type: BooleanConstructor; default: boolean }
    onClick: { type: PropType<SlideThumbnailProps['onClick']>; default: undefined }
    aspect: { type: PropType<'16/9' | '4/3' | '1/1'>; default: string }
    width: { type: NumberConstructor; default: number }
    className: { type: StringConstructor; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      index: { type: NumberConstructor; required: true }
      children: null
      active: { type: BooleanConstructor; default: boolean }
      onClick: { type: PropType<SlideThumbnailProps['onClick']>; default: undefined }
      aspect: { type: PropType<'16/9' | '4/3' | '1/1'>; default: string }
      width: { type: NumberConstructor; default: number }
      className: { type: StringConstructor; default: undefined }
    }>
  > &
    Readonly<{}>,
  {
    onClick: ((event: MouseEvent) => void) | undefined
    active: boolean
    aspect: '16/9' | '4/3' | '1/1'
    width: number
    className: string
  },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see SlideThumbnailProps).

Returns: The slide thumbnail component.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-ui ^1.4.0
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.5.0 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-i18n

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • Requires a wired ClassMap bond (e.g. @molecule/app-ui-tailwind) — getClassMap() throws before bonding.

  • The tile canvas is the theme's surface token (cm.surface) and the index badge sits on a theme scrim (cm.bgScrim + cm.textOnTone), so both follow the app's theme — render your own themed preview inside the default slot.

  • The active outline uses currentColor; set a text color on a parent to control it.

  • The index label's aria-label comes from t('slideThumbnail.label') with an English fallback, read through the binding's useTranslation(), so a locale switch updates it at once.

  • Companion locale bond: @molecule/app-locales-slide-thumbnail.

Translations

Translation strings are provided by @molecule/app-locales-slide-thumbnail.