Installation
Requirements
Start with a Vue 3 application. Legato UI requires Vue 3.4 or later in the Vue 3 series. If your project uses TypeScript, use version 5.4 or later.
Install the package
Run the command from your application directory. If Vue is missing from its dependencies, add vue with the same package manager.
Install with pnpm
pnpm add legato-uiLoad styles and a theme
Add the imports to your application entry, such as main.ts. The example uses Legato and Legato Sans. The reset and layout utilities are optional. For dark mode, import themes/legato-dark.css and set data-wl-theme to legato-dark. For SSR, set the attribute in the server-rendered HTML.
Show Vue code
import { createApp } from "vue";
import App from "./App.vue";
import "legato-ui/styles/reset.css";
import "legato-ui/styles/base.css";
import "legato-ui/styles/primitives.css";
import "legato-ui/styles/fonts/legato.css";
import "legato-ui/themes/legato.css";
document.documentElement.dataset.wlTheme = "legato";
createApp(App).mount("#app");Render your first component
Paste this example into App.vue and start your application. The number on the button increases on each click.
Show Vue code
<script setup lang="ts">
import { ref } from "vue";
import { WlButton } from "legato-ui";
const count = ref(0);
</script>
<template>
<WlButton @click="count++">Clicks {{ count }}</WlButton>
</template>Set built-in labels to Russian
Built-in labels use English by default. In main.ts replace the createApp and mount line with this setup to enable Russian labels for the application.
Show Vue code
import { WlConfig, wlLocaleRu } from "legato-ui";
const app = createApp(App);
app.use(WlConfig, { locale: wlLocaleRu });
app.mount("#app");