Seleção e menus
VTimeRange
Barra compacta de intervalo de horário `12:00 → 12:30 · 30min`, usando `<input type="time">` nativo (teclado e leitores de tela inclusos). Emite `change` com `{ start, end, minutes }`.
<script setup lang="ts">
import { VTimeRange } from 'vueui-nova-kit'
</script>Uso
<VTimeRange v-model:start="start" v-model:end="end" @close="hide" />Playground
Os controles abaixo são gerados a partir das props declaradas em VTimeRange.types.ts; o código acompanha cada mudança.
Exemplos
Variantes, tamanhos e estados, extraídos das stories da biblioteca.
Default
Variação Padrão. Edite os horários para ver a duração.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeRange } from 'vueui-nova-kit'
const args = {
start: '12:00',
end: '12:30',
step: 5,
showDuration: true,
closable: true,
disabled: false,
size: 'md'
}
const start = ref('12:00')
const end = ref('12:30')
</script>
<template>
<VTimeRange v-bind="args" v-model:start="start" v-model:end="end" />
</template>Overnight
Variação Passa da meia-noite.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeRange } from 'vueui-nova-kit'
const args = {
start: '23:30',
end: '01:15',
step: 5,
showDuration: true,
closable: true,
disabled: false,
size: 'md'
}
const start = ref('23:30')
const end = ref('01:15')
</script>
<template>
<VTimeRange v-bind="args" v-model:start="start" v-model:end="end" />
</template>Small
Variação Compacta sem fechar.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTimeRange } from 'vueui-nova-kit'
const args = {
start: '12:00',
end: '12:30',
step: 5,
showDuration: true,
closable: false,
disabled: false,
size: 'sm'
}
const start = ref('12:00')
const end = ref('12:30')
</script>
<template>
<VTimeRange v-bind="args" v-model:start="start" v-model:end="end" />
</template>Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
start | string | "09:00" | Start time `HH:MM` (`v-model:start`). |
end | string | "10:00" | End time `HH:MM` (`v-model:end`). An end before the start wraps past midnight. |
step | number | 5 | Minute step for the native time inputs. |
showDuration | boolean | true | — |
closable | boolean | true | — |
disabled | boolean | false | — |
size | VTimeRangeSize | "md" | — |
startLabel | string | "Start time" | — |
endLabel | string | "End time" | — |
dataTestId | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:start | value: string | — |
@update:end | value: string | — |
@change | range: { start: string; end: string; minutes: number } | — |
@close | — | — |
Slots
Sem slots.
Fonte: src/components/form/VTimeRange/VTimeRange.vue · tipos: src/components/form/VTimeRange/VTimeRange.types.ts