# Time input (UI SDK): Invalid

> `invalid` marks the field for checks of your own, like an end time before the start.

Canonical: https://hextaui.com/docs/ui-sdk-time-input/examples/range

Component docs: https://hextaui.com/docs/ui-sdk-time-input

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/ui-sdk-time-input-range.json
```

This adds `components/examples/ui-sdk-time-input/range.tsx` with the Time input component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/ui-sdk-time-input/range.tsx"
"use client"

import * as React from "react"

import { Label } from "@/components/ui/label"
import { TimeInput } from "@/components/ui/ui-sdk-time-input"

function UiSdkTimeInputRange() {
  const [start, setStart] = React.useState<string | null>("13:00")
  const [end, setEnd] = React.useState<string | null>("12:30")
  const invalid = start !== null && end !== null && end <= start

  return (
    <div className="flex w-full max-w-72 flex-col gap-2">
      <div className="grid grid-cols-2 gap-2">
        <div className="flex flex-col gap-2">
          <Label id="shift-start">Starts</Label>
          <TimeInput
            aria-labelledby="shift-start"
            defaultValue="13:00"
            onValueChange={(value) => setStart(value)}
          />
        </div>
        <div className="flex flex-col gap-2">
          <Label id="shift-end">Ends</Label>
          <TimeInput
            aria-labelledby="shift-end"
            aria-describedby="shift-message"
            defaultValue="12:30"
            invalid={invalid}
            onValueChange={(value) => setEnd(value)}
          />
        </div>
      </div>
      <p
        id="shift-message"
        className={
          invalid
            ? "m-0 text-xs text-destructive"
            : "m-0 text-xs text-muted-foreground"
        }
      >
        {invalid ? "The shift has to end after it starts." : "One shift a day."}
      </p>
    </div>
  )
}

export { UiSdkTimeInputRange }
```

## Props in this example

### TimeInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `string \| null` | – |  |
| `onValueChange` | `(value: string \| null, details) => void` | – | Runs once every part holds something, and with null when one is emptied. |
| `invalid` | `boolean` | `false` |  |

## More Time input examples

- [Clock and seconds](https://hextaui.com/docs/ui-sdk-time-input/examples/clock)
- [Min and max](https://hextaui.com/docs/ui-sdk-time-input/examples/min-max)
- [Locale](https://hextaui.com/docs/ui-sdk-time-input/examples/locale)
- [Form](https://hextaui.com/docs/ui-sdk-time-input/examples/form)
- [Controller](https://hextaui.com/docs/ui-sdk-time-input/examples/controller)
- [Disabled](https://hextaui.com/docs/ui-sdk-time-input/examples/disabled)
- [Read-only](https://hextaui.com/docs/ui-sdk-time-input/examples/read-only)
- [Right to left](https://hextaui.com/docs/ui-sdk-time-input/examples/rtl)
