Dyskans Vue

Darnow unn-restren Vue 3 gans perthynasow tyskys, defineModel kesyanns diwo-fordh, ha v-bind="$attrs" dres-passya.

Pyth a wrewgh drehevel

Furv kestava byghan — mewnos gans lavell, botton danvon, v-model kesyanns, hwedhel klavyer ha skrin-redyer gwir — kynsa noeth, ena stylys, yn a-dro dhe 10 mynysenn.

Kyns dalleth

Ty a'n jeves othom a git, Node 22 po nowodhyes, ha pnpm 10 po nowodhyes. Raglen Vue 3 vyth a ober — Nuxt, Vite, po Vue plen.

Kamm 1 — Kevewgh an koodh

git clone https://github.com/LilyDesignSystem/lily-design-system
cd lily-design-system/lily-design-system-vue-headless
pnpm install
pnpm test        # vitest + @testing-library/vue
pnpm run storybook   # browse all 571 components

An darnow yw restrennow plat yn components/ — Button.vue, TextInput.vue — pub onan gans y brov, story, ha dhogynnans ryb. Kopiewgh an restrennow a'n jeves othom, po vendorewgh an gwithva.

Kamm 2 — Dha dharn kynsa

<script setup>
import Button from "lily-design-system-vue-headless/components/Button.vue";
</script>

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

Dyskwedh <button class="button" type="button">. Perthynasow a gessenva orth an framwyth erell: type, disabled, pressed, label, ha dres-perthyn rag peub tra aral.

Kamm 3 — Kesstrewewgh furv byghan

<script setup>
import { ref } from "vue";
import Form from ".../components/Form.vue";
import Field from ".../components/Field.vue";
import TextInput from ".../components/TextInput.vue";
import Button from ".../components/Button.vue";

const name = ref("");
</script>

<template>
  <Form @submit="handleSubmit">
    <Field label="Full name" required>
      <TextInput id="name" label="Full name" v-model="name" required />
    </Field>
    <Button type="submit">Save</Button>
  </Form>
</template>

Field a gemmer an label avel perthynas y honan yn le darn lavell nessys — passewgh hi unnweyth, war Fieldha TextInputkehevelys war label a re an hanow hedhesys.

Gwiriys 2026-08-29: kynsa towl a nesas darn dyvers Label a-berth Field, hag a dhyskwedhas dew lavell (unn gwag) drefen Field seulajys a dhyskwedh y honan dhiworth an label perthynas — kefys dre gesolya an snippet ewn. An fordh furv-kestava kesstrewys yw an keth patrom, previys gans e2e ha axe gwir.

TextInput a wra devnydh a defineModel, rag henna plen v-model a ober yn-mes a'n bos.

Hwithrewgh dha oberenn: kerdhewgh an app ha'n furv a hevel plen — yn ewn herwydh bryntyans: an stylyans yw hwath a-rag. Gwaskewgh Tab: fokus a wayn dres pub kontroll, an lavell yw displetys, ha'n danvon a ober. An hwedhel yw gwrys; an semlant yw dhiso ha henna yw nessa.

Kamm 4 — Stylyewgh

Stylyewgh an krogow klass — .button, .text-input, .label, .field — yn dha folen-stil, po kevrewgh tebel parys yn index.html / nuxt.config:

<link rel="stylesheet" href="/themes/nord.css" />

Kamm 5 — Gwelewgh pubtra ow ’oberi

An App ensampel Nuxt yw an rolyans kowl stylys ha displetys, gans Playwright e2e ha linenn-selys axe-core:

git clone https://github.com/LilyDesignSystem/lily-design-system
cd lily-design-system/lily-design-system-vue-nuxt-examples
pnpm install && pnpm run dev

Kammow nessa

Govynnow war an fordh? An folen skoodhya yw leun a worthebow — ha mar pe kamm moy splann, leverewgh dhyn ha ni a wellha an dyskans yn lowen.