EditorToolbar

GitHub
A customizable toolbar for editor actions that can be displayed as fixed, bubble, or floating menu.

Usage

Examples

API

Props

Prop Default Type
as'div'any

The element or component this component should render as.

editorEditor
color'neutral' "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral"

The color of the toolbar controls.

variant'ghost' "solid" | "outline" | "soft" | "subtle" | "ghost" | "link"

The variant of the toolbar controls.

activeColor'primary' "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral"

The color of the active toolbar control.

activeVariant'soft' "solid" | "outline" | "soft" | "subtle" | "ghost" | "link"

The variant of the active toolbar control.

size'sm' "xs" | "sm" | "md" | "lg" | "xl"

The size of the toolbar controls.

items EditorToolbarItem[] | EditorToolbarItem[][]
layout'fixed' "fixed" | "floating" | "bubble"
ui { root?: ClassNameValue; base?: ClassNameValue; group?: ClassNameValue; separator?: ClassNameValue; }

Slots

Slot Type
default{}
item{ item: EditorToolbarItem; } & SlotPropsProps

Emits

Event Type

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    editorToolbar: {
      slots: {
        root: 'focus:outline-none',
        base: 'bg-default p-1 flex items-stretch gap-1.5',
        group: 'flex items-center gap-0.5',
        separator: 'w-px self-stretch bg-border'
      },
      variants: {
        layout: {
          bubble: {
            base: 'border border-default rounded-lg'
          },
          floating: {
            base: 'border border-default rounded-lg'
          },
          fixed: {
            base: ''
          }
        }
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        editorToolbar: {
          slots: {
            root: 'focus:outline-none',
            base: 'bg-default p-1 flex items-stretch gap-1.5',
            group: 'flex items-center gap-0.5',
            separator: 'w-px self-stretch bg-border'
          },
          variants: {
            layout: {
              bubble: {
                base: 'border border-default rounded-lg'
              },
              floating: {
                base: 'border border-default rounded-lg'
              },
              fixed: {
                base: ''
              }
            }
          }
        }
      }
    })
  ]
})

Changelog

No recent changes