Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

DateRangePicker

Selector de rango de fechas con dos meses a la vista y atajos para los rangos más usados.

Seguir leyendo — 2 párrafos más

DateRangePicker

Dual-month visual calendar range picker with preset shortcuts. Renders a trigger button showing the selected range; click opens a dropdown portalled to document.body with viewport-clamped floating position so it never clips inside Sheets, Dialogs, or overflow:hidden ancestors.

3 sitios de import en 2 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • cmp-packages
  • gestorsalon

El componente, montado

Cargando el espécimen…

Cómo se usa

import { DateRangePicker } from '@solu30/ui-kit/input'

Props

8 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
valuesíDateRangeValue—
onChangesí(range: DateRangeValue) => void—
presetsopcionalDateRangePresetOption[]Preset shortcut buttons shown below the calendars
formatDateopcional(date: Date) => stringOverride date formatting. Receives a Date, returns display string
monthNamesopcional[string, string, string, string, string, string, string, string, string, string, string, string]Month names (12 items, Jan → Dec)
dayNamesopcional[string, string, string, string, string, string, string]Day names (7 items, Dom → Sáb or Mon → Sun)
startOnSundayopcionalbooleanWhether week starts on Sunday (default: true to match Spanish locale)
classNameopcionalstringExtra class on trigger button

Ejemplo del paquete

import { DateRangePicker } from "@solu30/ui-kit";

const [range, setRange] = useState<DateRangeValue>({ from: null, to: null });

<DateRangePicker
  value={range}
  onChange={setRange}
  presets={[
    { label: "Última semana", from: subDays(new Date(), 7), to: new Date() },
    { label: "Último mes", from: startOfMonth(new Date()), to: new Date() },
  ]}
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.