Skip to main content

TimeOffFlow

Hub for creating and managing a company's time off policies.

Remarks

Composes the time off list, policy-type selection, configuration, settings, employee assignment, and policy detail screens into a single multi-step flow. Sick and vacation policies share a common creation path (configure → settings → add employees); holiday policies follow a separate path (select federal holidays → add employees). All policy types can be viewed, edited, and removed from the unified policy list.

The flow emits these events as users navigate:

Example

App.tsx
import { TimeOff } from '@gusto/embedded-react-sdk'

function MyApp() {
return (
<TimeOff.TimeOffFlow
companyId="a007e1ab-3595-43c2-ab4b-af7a5af2e365"
onEvent={() => {}}
/>
)
}

TimeOffFlowProps

Props for TimeOffFlow.

PropertyTypeDescription
companyIdstringThe associated company identifier.
onEventOnEventType<EventType, unknown>Callback invoked each time the component emits an event — user interactions, successful API responses, step transitions, or errors. Receives the event type constant and an optional payload whose shape varies by event. See the Event Handling guide and each component's event table for the full list of emitted events.

Inherits children, className, defaultValues, dictionary, FallbackComponent, LoaderComponent from BaseComponentInterface.

Events

EventDescriptionData
timeOff/createPolicyUser initiates policy creation
timeOff/viewPolicyUser selects a policy to view{ policyId: string, policyType: string }
timeOff/policyTypeSelectedUser selects a policy type{ policyType: 'sick' | 'vacation' | 'holiday' }
timeOff/policyDetails/donePolicy details form is submitted{ policyId: string, accrualMethod: string }
timeOff/policySettings/donePolicy settings are savedTimeOffPolicy response
timeOff/policySettings/backUser navigates back from settings
timeOff/addEmployees/doneEmployees are added to a sick/vacation policyTimeOffPolicy response
timeOff/addEmployees/backUser navigates back from employee selection
timeOff/holidaySelection/doneHoliday selection completed (create)
timeOff/holidaySelection/editDoneHoliday selection completed (edit)
timeOff/holidayAddEmployees/doneEmployees added to holiday policyHolidayPayPolicy response
timeOff/backToListUser navigates back to the policy list
timeOff/editPolicyUser edits a sick/vacation policy{ policyId: string }
timeOff/changeSettingsUser edits policy settings{ policyId: string }
timeOff/addEmployeesToPolicyUser adds employees from a policy detail{ policyId: string }
timeOff/holidayAddEmployeesUser adds employees from holiday detail
timeOff/editHolidayPolicyUser edits the holiday policy
timeOff/policyCreate/errorPolicy creation fails{ alert?: { type, title, content? } }
timeOff/policySettings/errorPolicy settings update fails{ alert?: { type, title, content? } }
timeOff/addEmployees/errorAdding employees to a policy fails{ alert?: { type, title, content? } }
timeOff/holidayCreate/errorHoliday policy creation fails{ alert?: { type, title, content? } }
timeOff/holidayAddEmployees/errorAdding employees to the holiday policy fails{ alert?: { type, title, content? } }
CANCELUser cancels the current step

Only one holiday policy can exist per company; the policy-type selector disables the holiday option once one is configured.

Sub-components

ComponentDescription
PolicyListDisplays all active time off policies (sick, vacation, and holiday) for a company.
PolicyTypeSelectorSelection screen for choosing which kind of time-off policy to create — sick, vacation, or holiday.
PolicyConfigurationFormForm for creating or editing the details of a sick or vacation time off policy — its name and accrual configuration.
PolicySettingsConfigures additional policy limits and rules for a sick or vacation policy. This step is skipped for policies with unlimited accrual.
AddEmployeesToPolicyEmployee selection screen for assigning employees to a sick or vacation time off policy.
TimeOffPolicyDetailDetail view for a sick or vacation time-off policy.
HolidaySelectionFormLets a user select which US federal holidays are observed by the company's holiday pay policy.
AddEmployeesHolidayEmployee selection screen for assigning employees to a company's holiday pay policy.
ViewHolidayPolicyDetailsDisplays the holiday pay policy for a company with tabbed views of the included holidays and the enrolled employees.

Step flow

The flow opens on the policy list (PolicyList), which acts as the hub: creating or opening a policy launches from it, and every step returns to it (timeOff/backToList, or cancel from a create step). There is no terminal step.

Create a policy

Selecting a type branches the path: sick and vacation share the configuration-and-settings path, while holiday follows its own. A policy with an unlimited accrual method skips the settings step, since there is no balance to cap or carry over. (Only one holiday policy can exist per company; the type selector disables holiday once one is configured.)

Manage an existing policy

Opening a policy routes by type to its detail view, which acts as a sub-hub. From the non-holiday detail view you can edit the policy (timeOff/editPolicy), change its settings (timeOff/changeSettings), or add employees (timeOff/addEmployeesToPolicy).

The holiday detail view (ViewHolidayPolicyDetails) presents the observed holidays and enrolled employees as two tabs; switching tabs is internal to the view and emits no flow event. From it you can edit the holiday selection (timeOff/editHolidayPolicy) or add employees (timeOff/holidayAddEmployees). Each action returns to its detail view; timeOff/backToList returns to the list.

Policy types

TypeDescriptionAPI family
SickSick leave policy with configurable accrual and balance rulesTime Off Policies
VacationVacation policy with configurable accrual and balance rulesTime Off Policies
HolidayPaid holiday policy based on US federal holidaysHoliday Pay Policies

Accrual methods

Sick and vacation policies support the following accrual methods. The accrual method drives whether the settings step appears (unlimited policies skip it) and which reset rules apply.

MethodDescription
UnlimitedEmployees have unlimited time off. No balance tracking or settings configuration required.
Per hour workedAccrues at a rate per hours worked. Optionally includes overtime and/or all paid hours.
Per pay periodFixed amount accrues each pay period.
Per calendar yearFixed amount accrues once per year, resetting on a specified calendar date.
Per anniversary yearFixed amount accrues once per year, resetting on each employee's hire anniversary.

Federal holidays

The holiday selection form includes all 11 US federal holidays. In create mode, all are selected by default.

HolidayObserved Date
New Year's DayJanuary 1
MLK DayThird Monday in January
Presidents' DayThird Monday in February
Memorial DayLast Monday in May
JuneteenthJune 19
Independence DayJuly 4
Labor DayFirst Monday in September
Columbus DaySecond Monday in October
Veterans DayNovember 11
ThanksgivingFourth Thursday in November
Christmas DayDecember 25

Endpoints