@maas/vue-primitive
Version:
Vue component for passing attributes to slot content
50 lines (34 loc) β’ 1.22 kB
Markdown
# π₯ Vue Primitive
## π¦ Install
```
pnpm install @maas/vue-primitive
```
## πͺ Use
### as
```vue
<template>
<Primitive as="button" type="button" @click="handleClick">
Click me
</Primitive>
</template>
```
```html
<button type="button">Click me</button>
```
### asChild
```vue
<template>
<Primitive as-child type="button" class="my-button" @click="handleClick">
<button>Click me</button>
</Primitive>
</template>
```
```html
<button type="button" class="my-button">Click me</button>
```
## π Found a Bug?
If you see something that doesnβt look right, [submit a bug report](https://github.com/magicasaservice/vue-primitive/issues/new?assignees=&labels=bug%2Cpending+triage&template=bug_report.yml). See it. Say it. Sorted.
## π€ Credit
This package is mostly a port of [Radix Vue](https://github.com/unovue/reka-ui/tree/v1)βs `Primitive` component. The original concept of the `asChild` prop was invented by the creators of [Radix Primitives](https://github.com/radix-ui/primitives) as far as we know.
## π License
[MIT License](https://github.com/magicasaservice/vue-primitive/blob/main/LICENSE) Β© 2024-PRESENT [Magic as a Service GmbH](https://github.com/magicasaservice)