Seleção e menus

VTimeRange

Componente3 exemplos10 propsA2UI · TimeRange

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 }`.

Importação
<script setup lang="ts">
import { VTimeRange } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<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
vue
<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
vue
<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
vue
<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

PropTipoDefaultDescrição
startstring"09:00"Start time `HH:MM` (`v-model:start`).
endstring"10:00"End time `HH:MM` (`v-model:end`). An end before the start wraps past midnight.
stepnumber5Minute step for the native time inputs.
showDurationbooleantrue—
closablebooleantrue—
disabledbooleanfalse—
sizeVTimeRangeSize"md"—
startLabelstring"Start time"—
endLabelstring"End time"—
dataTestIdstring——

Events

EventoPayloadDescrição
@update:startvalue: string—
@update:endvalue: string—
@changerange: { 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