Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Learn

Core concepts

These are the Vue ideas you will see on component pages. Start with the first example; come back to the others when you need them.

Props change a component

A prop is a value you pass to a component. Here, variant changes how Button looks, and size changes its height. If you leave them out, Button uses its defaults.

Button props
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'
</script>

<template>
  <Button variant="outline" size="sm">Cancel</Button>
</template>

A model holds a value

v-model connects a component's value to a Vue variable. Typing in this Input changes email, and changing email updates the Input. Use a ref when your page needs to react to that value.

Input model
<script setup lang="ts">
import { ref } from 'vue'
import Input from './components/ui/input/Input.vue'

const email = ref('')
</script>

<template>
  <label for="email">Email</label>
  <Input id="email" v-model="email" type="email" />
  <p>You entered: {{ email }}</p>
</template>

Events tell your page what happened

@click runs your function when someone activates Button. Other components emit events such as change or update:open. Each component's API reference lists its events.

Button click
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'

function save() {
  // Save your data here.
}
</script>

<template>
  <Button @click="save">Save</Button>
</template>

Slots hold your content

The words between <Button> and </Button> are the Button's default slot. Some components also have named slots for a prefix, suffix, actions, or other content. A slot lets you provide your own text or markup without changing the component's behavior.

Button slots
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'
</script>

<template>
  <Button>
    <template #prefix><span aria-hidden="true">+</span></template>
    Add item
  </Button>
</template>

“Add item” is the label in the default slot. The plus sign goes in the named prefix slot; aria-hidden keeps that decorative sign out of the spoken label.

Compound components work together

Some controls have several named parts. Dialog owns whether it is open; DialogTrigger opens it; DialogContent holds the content; DialogTitle names it. Keeping the parts separate lets you arrange real content while Dialog manages focus and keyboard behavior.

Dialog parts
<script setup lang="ts">
import Dialog from './components/ui/dialog/Dialog.vue'
import DialogTrigger from './components/ui/dialog/DialogTrigger.vue'
import DialogContent from './components/ui/dialog/DialogContent.vue'
import DialogTitle from './components/ui/dialog/DialogTitle.vue'
</script>

<template>
  <Dialog>
    <DialogTrigger>Open settings</DialogTrigger>
    <DialogContent>
      <DialogTitle>Settings</DialogTitle>
      <p>Put your settings here.</p>
    </DialogContent>
  </Dialog>
</template>

The source lives in your app

The Weini CLI copies component files into your project. You import those files directly. You can inspect and edit them like any other source code. weini.json records what was installed so you can check for updates later.

Choose by interaction

NeedComponentChoose it when
One value from a fixed listSelectThe user chooses an option without typing a query.
Searchable single valueComboboxThe user can type to filter or find one option.
Several values from a listMultiSelectThe user can commit and remove multiple options.
NeedComponentChoose it when
Inline date gridCalendarDates belong directly in the page.
One date in a fieldDatePickerA single date is the field value.
Start and end datesDatePickerRangeThe value is a date range.
Date and time in one fieldDateTimePickerThe value is one local date-time.
Time without a dateTimePickerThe value is a time of day.
NeedComponentChoose it when
Commands opened by a buttonDropdownMenuActions belong to a specific trigger.
Commands at the pointer or long pressContextMenuActions depend on the content that was invoked.
Persistent desktop command groupsMenubarThe app uses a menu bar with top-level groups such as File and Edit.
Site or app section navigationNavigationMenuThe open panel contains links between sections or pages.

Ready to build? Browse all components or return to Getting started.