# Schedule builder

Build a daily, weekly, or monthly schedule with an exact five-field cron value.

Access: pro. Category: Forms. Kind: composite.

## When to use

- Use it when a page needs build a daily, weekly, or monthly schedule with an exact five-field cron value.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose form-field instead when a labeled email field with validation and help text is the actual interface need, rather than schedule builder.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Schedule builder

```sh
npx shadcn@latest add @tidal-pro/schedule-builder
```

Stylesheets: `components/ui/tidal.css`, `components/ui/schedule-builder.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/schedule-builder.css";
import{TidalScheduleBuilder}from"./components/ui/schedule-builder";
export default(p:Parameters<typeof TidalScheduleBuilder>[0])=><div className="tidal-scope"><TidalScheduleBuilder {...p}/></div>;
```

## Structured props

- `TidalScheduleBuilder.onTimezoneChange: (value: string, event: ChangeEvent<HTMLSelectElement>) => void`: Callback invoked when the timezone change interaction is proposed.
- `TidalScheduleBuilder.onValueChange: (value: TidalScheduleValue, source: "frequency" | "time" | "weekday" | "month-day", event: ChangeEvent<HTMLInputElement>) => void`: Callback invoked when the value change interaction is proposed.
- `TidalScheduleBuilder.timezone: string`: Required timezone value accepted by this exported component.
- `TidalScheduleBuilder.timezones: ReadonlyArray<TidalScheduleTimezone>`: Required timezones value accepted by this exported component.
- `TidalScheduleBuilder.title: ReactNode`: Required title value accepted by this exported component.
- `TidalScheduleBuilder.value: TidalScheduleValue`: Required value value accepted by this exported component.
- `TidalScheduleBuilder.busy?: boolean | undefined` (default false): Optional busy value accepted by this exported component.
- `TidalScheduleBuilder.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalScheduleBuilder.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalScheduleBuilder.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalScheduleBuilder.headingLevel?: "h2" | "h3" | "h4" | "h5" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalScheduleBuilder.labels?: Partial<{ frequency: string; daily: string; weekly: string; monthly: string; time: string; weekdays: string; monthDay: string; timezone: string; expression: string; preview: string; previewEmpty: string; invalidConfiguration: string; invalidTime: string; chooseWeekday: string; invalidMonthDay: string; }> | undefined`: Optional labels value accepted by this exported component.
- `TidalScheduleBuilder.monthDayInputProps?: MonthInputProps | undefined`: Optional month day input props value accepted by this exported component.
- `TidalScheduleBuilder.monthDayRef?: Ref<HTMLInputElement> | undefined`: Optional month day ref value accepted by this exported component.
- `TidalScheduleBuilder.name?: string | undefined` (default "schedule"): Optional name value accepted by this exported component.
- `TidalScheduleBuilder.nextRuns?: ReadonlyArray<TidalSchedulePreviewItem> | undefined`: Optional next runs value accepted by this exported component.
- `TidalScheduleBuilder.onSubmit?: ((event: FormEvent<HTMLFormElement>) => void) | undefined`: Callback invoked when the submit interaction is proposed.
- `TidalScheduleBuilder.readOnly?: boolean | undefined` (default false): Optional read only value accepted by this exported component.
- `TidalScheduleBuilder.submitLabel?: ReactNode` (default "Save schedule"): Optional submit label value accepted by this exported component.
- `TidalScheduleBuilder.submitProps?: SubmitProps | undefined`: Optional submit props value accepted by this exported component.
- `TidalScheduleBuilder.submitRef?: Ref<HTMLButtonElement> | undefined`: Optional submit ref value accepted by this exported component.
- `TidalScheduleBuilder.timeInputProps?: TimeInputProps | undefined`: Optional time input props value accepted by this exported component.
- `TidalScheduleBuilder.timeRef?: Ref<HTMLInputElement> | undefined`: Optional time ref value accepted by this exported component.
- `TidalScheduleBuilder.timezoneName?: string | undefined` (default "timezone"): Optional timezone name value accepted by this exported component.
- `TidalScheduleBuilder.timezoneProps?: SelectProps | undefined`: Optional timezone props value accepted by this exported component.
- `TidalScheduleBuilder.timezoneRef?: Ref<HTMLSelectElement> | undefined`: Optional timezone ref value accepted by this exported component.
- `TidalScheduleBuilder.weekdayLabels?: Partial<Record<TidalScheduleWeekday, string>> | undefined`: Optional weekday labels value accepted by this exported component.
- `TidalScheduleBuilder.weekdayRef?: ((day: TidalScheduleWeekday) => Ref<HTMLInputElement> | undefined) | undefined`: Optional weekday ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/schedule-builder.tsx) | [Manifest](https://tidalui.com/examples/schedule-builder.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useMemo, useState, type FormEvent } from "react";

import { TidalScheduleBuilder, buildScheduleExpression, type TidalSchedulePreviewItem, type TidalScheduleValue } from "./components/ui/schedule-builder";

import "./components/ui/schedule-builder.css";



const tidalExampleStyles = ".tidal-schedule-demo {\n  width: min(100%, 720px);\n  display: grid;\n  gap: 14px;\n}\n\n.tidal-schedule-demo-footer {\n  display: flex;\n  gap: 12px;\n  align-items: center;\n  justify-content: space-between;\n  padding-inline: 4px;\n}\n\n.tidal-schedule-demo-footer p {\n  min-width: 0;\n  margin: 0;\n  color: var(--t-muted);\n  font-size: 12px;\n  line-height: 1.5;\n  overflow-wrap: anywhere;\n}\n\n.tidal-schedule-demo-footer button {\n  min-width: 112px;\n  min-height: 44px;\n  flex: 0 0 auto;\n  padding: 8px 14px;\n  border: 1px solid var(--t-line);\n  border-radius: var(--t-radius-control);\n  background: var(--t-canvas);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 12px;\n  font-weight: 750;\n  white-space: normal;\n  overflow-wrap: anywhere;\n  cursor: pointer;\n}\n\n.tidal-schedule-demo-footer button:focus-visible {\n  outline: 3px solid var(--t-focus);\n  outline-offset: 3px;\n}\n\n@media (max-width: 420px) {\n  .tidal-schedule-demo-footer {\n    align-items: stretch;\n    flex-direction: column;\n  }\n\n  .tidal-schedule-demo-footer button {\n    width: 100%;\n  }\n}";

const INITIAL: TidalScheduleValue = {
  frequency: "weekly",
  time: "09:30",
  weekdays: ["mon", "thu"],
  monthDay: 15,
};

const TIMEZONES = [
  { value: "UTC", label: "UTC" },
  { value: "America/Chicago", label: "Central time" },
  { value: "Europe/London", label: "London time" },
] as const;

const DAY_NAMES = {
  sun: "Sunday",
  mon: "Monday",
  tue: "Tuesday",
  wed: "Wednesday",
  thu: "Thursday",
  fri: "Friday",
  sat: "Saturday",
} as const;

function previewSchedule(
  value: TidalScheduleValue,
  timezone: string,
): readonly TidalSchedulePreviewItem[] {
  if (value.frequency === "daily")
    return [
      { id: "daily-next", label: `Every day at ${value.time} · ${timezone}` },
    ];
  if (value.frequency === "weekly")
    return value.weekdays.slice(0, 3).map((day) => ({
      id: day,
      label: `Every ${DAY_NAMES[day]} at ${value.time} · ${timezone}`,
    }));
  return [
    {
      id: "monthly-next",
      label: `Day ${value.monthDay} of each month at ${value.time} · ${timezone}`,
    },
  ];
}

export function ScheduleBuilderDemo() {
  const [value, setValue] = useState<TidalScheduleValue>(INITIAL);
  const [timezone, setTimezone] = useState("UTC");
  const [status, setStatus] = useState(
    "Local sample. No schedule has been created.",
  );
  const nextRuns = useMemo(
    () => previewSchedule(value, timezone),
    [value, timezone],
  );

  function clearStatus() {
    setStatus("Local sample updated. No schedule has been created.");
  }

  function submit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    const expression = buildScheduleExpression(value);
    setStatus(
      expression
        ? `Prepared ${expression} for ${timezone}. No schedule was created.`
        : "Complete the schedule before preparing it.",
    );
  }

  return (
    <div className="tidal-schedule-demo">
      <TidalScheduleBuilder
        id="tidal-schedule-demo-form"
        title="Workspace summary"
        description="Choose when the local report should be prepared."
        value={value}
        onValueChange={(next) => {
          setValue(next);
          clearStatus();
        }}
        timezone={timezone}
        timezones={TIMEZONES}
        onTimezoneChange={(next) => {
          setTimezone(next);
          clearStatus();
        }}
        nextRuns={nextRuns}
        labels={{ preview: "Schedule summary" }}
        onSubmit={submit}
        onReset={(event) => {
          event.preventDefault();
          setValue(INITIAL);
          setTimezone("UTC");
          setStatus("Sample schedule reset.");
        }}
        submitProps={{ formMethod: "post" }}
      />
      <div className="tidal-schedule-demo-footer">
        <p aria-live="polite">{status}</p>
        <button type="reset" form="tidal-schedule-demo-form">
          Reset sample
        </button>
      </div>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <ScheduleBuilderDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Controlled daily, weekly, and monthly models produce an exact five-field Unix cron expression while keeping timezone as a separate consumer-owned native value. Weekly day numbers use Sunday 0 through Saturday 6. Consumer-supplied timezone options and next-run items keep DST, locale, and recurrence prediction outside the primitive. Root form, input, select, submitter and control refs; native action/method and submitter overrides; caller-first field changes and valid submit handling; disabled, read-only and busy states; heading levels; translated labels; native reset ownership; exact hidden form serialization; guarded focus recovery; validation and narrow/RTL/reduced-motion layouts are supported. Blocked direct submissions never reach the consumer callback. No schedule is created, persisted, requested, or run.
