mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 08:23:47 +09:00
first
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
---
|
||||
state:
|
||||
input: 2
|
||||
---
|
||||
|
||||
### VRangeRating
|
||||
|
||||
Vuero provides number rating component with minimum styling.
|
||||
`VRangeRating` act like a radio button group, with a custom style, this means
|
||||
that you can use keyboard navigation to select the rating.
|
||||
Always wrap your inputs inside a `<VField />` and a `<VControl />`
|
||||
to build forms quickly and efficiently.
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const input = ref(2)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="input" />
|
||||
</VControl>
|
||||
</VField>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="frontmatter.state.input"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
|
||||
<!--/example-->
|
||||
@@ -0,0 +1,167 @@
|
||||
---
|
||||
state:
|
||||
hears: 2
|
||||
water: 3
|
||||
electric: 1
|
||||
kitty: 4
|
||||
---
|
||||
|
||||
### Custom Icon
|
||||
|
||||
You can use default slot to customize the icon.
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const hears = ref(2)
|
||||
const water = ref(3)
|
||||
const electric = ref(1)
|
||||
const kitty = ref(4)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="is-flex is-justify-content-space-between is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="hears">
|
||||
<VIcon
|
||||
v-if="isSelected"
|
||||
icon="ic:baseline-favorite"
|
||||
class="is-size-3 mr-1 has-text-warning"
|
||||
:class="{
|
||||
'has-text-danger': isSelected,
|
||||
}"
|
||||
/>
|
||||
<VIcon
|
||||
v-else
|
||||
icon="ic:baseline-favorite-border"
|
||||
class="is-size-3 mr-1"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="water">
|
||||
<VIcon
|
||||
icon="ic:twotone-water-drop"
|
||||
class="is-size-3 mr-1"
|
||||
:class="{
|
||||
'has-text-info': isSelected,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="electric">
|
||||
<VIcon
|
||||
:icon="isSelected ? 'material-symbols:bolt' : 'material-symbols:bolt-outline'"
|
||||
class="is-size-3 mr-1"
|
||||
:class="{
|
||||
'has-text-warning': isSelected,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="kitty">
|
||||
<VIcon
|
||||
:icon="
|
||||
isSelected
|
||||
? 'streamline-emojis:smiling-cat-face-with-heart-eyes'
|
||||
: 'streamline-emojis:cat-face'
|
||||
"
|
||||
class="is-size-3 mr-1"
|
||||
:style="{
|
||||
filter: isSelected ? undefined : 'grayscale(1)',
|
||||
opacity: isSelected ? undefined : 0.5,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<div>
|
||||
<div
|
||||
class="is-flex is-justify-content-space-between is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="frontmatter.state.hears">
|
||||
<VIcon
|
||||
v-if="isSelected"
|
||||
icon="ic:baseline-favorite"
|
||||
class="is-size-3 mr-1 has-text-warning"
|
||||
:class="{
|
||||
'has-text-danger': isSelected,
|
||||
}"
|
||||
/>
|
||||
<VIcon v-else icon="ic:baseline-favorite-border" class="is-size-3 mr-1" />
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="frontmatter.state.water">
|
||||
<VIcon
|
||||
icon="ic:twotone-water-drop"
|
||||
class="is-size-3 mr-1"
|
||||
:class="{
|
||||
'has-text-info': isSelected,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="frontmatter.state.electric">
|
||||
<VIcon
|
||||
:icon="isSelected ? 'material-symbols:bolt' : 'material-symbols:bolt-outline'"
|
||||
class="is-size-3 mr-1"
|
||||
:class="{
|
||||
'has-text-warning': isSelected,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-slot="{ isSelected }" v-model="frontmatter.state.kitty">
|
||||
<VIcon
|
||||
:icon="
|
||||
isSelected
|
||||
? 'streamline-emojis:smiling-cat-face-with-heart-eyes'
|
||||
: 'streamline-emojis:cat-face'
|
||||
"
|
||||
class="is-size-3 mr-1"
|
||||
:style="{
|
||||
filter: isSelected ? undefined : 'grayscale(1)',
|
||||
opacity: isSelected ? undefined : 0.5,
|
||||
}"
|
||||
/>
|
||||
</VRangeRating>
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--/example-->
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
state:
|
||||
input: 7
|
||||
---
|
||||
|
||||
### Accessible label
|
||||
|
||||
To add a label to the rating component, use the `label` prop. You can also
|
||||
use the `label` slot to customize the label.
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const input = ref(2)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="input" label="Rating" />
|
||||
</VControl>
|
||||
</VField>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="frontmatter.state.input"
|
||||
label="Rating"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
|
||||
<!--/example-->
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
state:
|
||||
input: 7
|
||||
---
|
||||
|
||||
### Change max values
|
||||
|
||||
You can change the max value of the rating component by using the `max` prop
|
||||
which defaults to `5`.
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const input = ref(2)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="input" :max="10" />
|
||||
</VControl>
|
||||
</VField>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="frontmatter.state.input"
|
||||
:max="10"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
|
||||
<!--/example-->
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
state:
|
||||
input: 2
|
||||
---
|
||||
|
||||
### Readonly and disabled
|
||||
|
||||
To make the rating component readonly or disabled, use the `readonly` and `disabled` props.
|
||||
The `readonly` prop will make the rating component readonly by disabling
|
||||
the user interaction, while the `disabled` prop will make the rating component
|
||||
disabled by disabling value changes.
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const input = ref(2)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="is-flex is-justify-content-space-between is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="Readonly"
|
||||
readonly
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="Disabled"
|
||||
disabled
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<div>
|
||||
<div
|
||||
class="is-flex is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Readonly" readonly />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Disabled" disabled />
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--/example-->
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
state:
|
||||
input: 3
|
||||
---
|
||||
|
||||
### Adjusting the size
|
||||
|
||||
You can adjust the size of the rating component by using the `size` prop which
|
||||
|
||||
<!--code-->
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
|
||||
const input = ref(2)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="is-flex is-justify-content-space-between is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="Small"
|
||||
size="small"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="input" label="Default" />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="Medium"
|
||||
size="medium"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="Large"
|
||||
size="large"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating
|
||||
v-model="input"
|
||||
label="XLarge"
|
||||
size="xlarge"
|
||||
/>
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
<!--/code-->
|
||||
|
||||
<!--example-->
|
||||
|
||||
<div
|
||||
class="is-flex is-flex-wrap-wrap"
|
||||
:style="{ gap: '2rem' }"
|
||||
>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Small" size="small" />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Default" />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Medium" size="medium" />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="Large" size="large" />
|
||||
</VControl>
|
||||
</VField>
|
||||
<VField>
|
||||
<VControl>
|
||||
<VRangeRating v-model="frontmatter.state.input" label="XLarge" size="xlarge" />
|
||||
</VControl>
|
||||
</VField>
|
||||
</div>
|
||||
|
||||
<!--/example-->
|
||||
Reference in New Issue
Block a user