# nylas-availability-picker

Source: https://developer.nylas.com/docs/reference/ui/availability-picker/

The `nylas-availability-picker` component is a form input for selecting availability (open hours).

## Overview

- **Tag**: `<nylas-availability-picker>`
- **Encapsulation**: shadow

## Installation

### HTML / Web Component

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@nylas/web-elements/dist/cdn/nylas-web-elements/nylas-web-elements.esm.js"></script>
```

### React

```bash
npm install @nylas/react
```

## Usage

### HTML

```html
<nylas-availability-picker></nylas-availability-picker>
```

### React

```jsx
import { NylasAvailabilityPicker } from '@nylas/react';

export default function Example() {
  return <NylasAvailabilityPicker />;
}
```

## Props

| Property | Attribute | Type | Default | Required | Description |
| --- | --- | --- | --- | --- | --- |
| `defaultTimezone` | `default-timezone` | string | `Intl.DateTimeFormat().resolvedOptions().timeZone` | No | The default timezone or preset timezone. |
| `hideHeader` | `hide-header` | boolean | `false` | No |  |
| `name` | `name` | string | `'availability'` | No | The name of the availability picker. |
| `openHours` | `open-hours` | OpenHours[] \| undefined | - | No | The open hours to display. |
| `selectedConfiguration` | `selected-configuration` | Configuration \| undefined | - | No |  |
| `selectedLanguage` | `selected-language` | LANGUAGE_CODE.de \| LANGUAGE_CODE.en \| LANGUAGE_CODE.es \| LANGUAGE_CODE.fr \| LANGUAGE_CODE.ja \| LANGUAGE_CODE.ko \| LANGUAGE_CODE.nl \| LANGUAGE_CODE.sv \| LANGUAGE_CODE.zh \| undefined | - | No | The selected language. |
| `showHeader` | `show-header` | boolean | `true` | No | Whether to display the header section. |
| `themeConfig` | `theme-config` | undefined \| { '--nylas-primary'?: string \| undefined; '--nylas-info'?: string \| undefined; '--nylas-success'?: string \| undefined; '--nylas-warning'?: string \| undefined; '--nylas-error'?: string \| undefined; '--nylas-error-pressed'?: string \| undefined; '--nylas-base-0'?: string \| undefined; '--nylas-base-25'?: string \| undefined; '--nylas-base-50'?: string \| undefined; '--nylas-base-100'?: string \| undefined; '--nylas-base-200'?: string \| undefined; '--nylas-base-300'?: string \| undefined; '--nylas-base-400'?: string \| undefined; '--nylas-base-500'?: string \| undefined; '--nylas-base-600'?: string \| undefined; '--nylas-base-700'?: string \| undefined; '--nylas-base-800'?: string \| undefined; '--nylas-base-900'?: string \| undefined; '--nylas-base-950'?: string \| undefined; '--nylas-color-blue-50'?: string \| undefined; '--nylas-color-blue-100'?: string \| undefined; '--nylas-color-blue-300'?: string \| undefined; '--nylas-color-blue-500'?: string \| undefined; '--nylas-color-blue-700'?: string \| undefined; '--nylas-color-blue-900'?: string \| undefined; '--nylas-color-red-50'?: string \| undefined; '--nylas-color-red-100'?: string \| undefined; '--nylas-color-red-300'?: string \| undefined; '--nylas-color-red-500'?: string \| undefined; '--nylas-color-red-700'?: string \| undefined; '--nylas-color-red-900'?: string \| undefined; '--nylas-color-green-50'?: string \| undefined; '--nylas-color-green-100'?: string \| undefined; '--nylas-color-green-300'?: string \| undefined; '--nylas-color-green-500'?: string \| undefined; '--nylas-color-green-700'?: string \| undefined; '--nylas-color-green-900'?: string \| undefined; '--nylas-color-yellow-50'?: string \| undefined; '--nylas-color-yellow-100'?: string \| undefined; '--nylas-color-yellow-300'?: string \| undefined; '--nylas-color-yellow-500'?: string \| undefined; '--nylas-color-yellow-700'?: string \| undefined; '--nylas-color-yellow-900'?: string \| undefined; '--nylas-color-purple-50'?: string \| undefined; '--nylas-color-purple-100'?: string \| undefined; '--nylas-color-purple-300'?: string \| undefined; '--nylas-color-purple-500'?: string \| undefined; '--nylas-color-purple-700'?: string \| undefined; '--nylas-color-purple-900'?: string \| undefined; '--nylas-color-sky-50'?: string \| undefined; '--nylas-color-sky-100'?: string \| undefined; '--nylas-color-sky-300'?: string \| undefined; '--nylas-color-sky-500'?: string \| undefined; '--nylas-color-sky-700'?: string \| undefined; '--nylas-color-sky-900'?: string \| undefined; '--nylas-color-black'?: string \| undefined; '--nylas-color-grey-900'?: string \| undefined; '--nylas-color-grey-800'?: string \| undefined; '--nylas-color-grey-700'?: string \| undefined; '--nylas-color-grey-600'?: string \| undefined; '--nylas-color-grey-500'?: string \| undefined; '--nylas-color-grey-400'?: string \| undefined; '--nylas-color-grey-300'?: string \| undefined; '--nylas-color-grey-200'?: string \| undefined; '--nylas-color-grey-100'?: string \| undefined; '--nylas-color-grey-50'?: string \| undefined; '--nylas-color-white'?: string \| undefined; '--nylas-font-family'?: string \| undefined; '--nylas-font-size'?: string \| undefined; '--nylas-border-radius'?: string \| undefined; '--nylas-border-radius-2x'?: string \| undefined; '--nylas-border-radius-3x'?: string \| undefined; } | - | No | The theme configuration. |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `valueChanged` | { value: string; name: string; } | This event is fired when the selected availability / open hours change. The value is a stringified JSON object with the open hours and timezone. ``` { openHours: OpenHours[], timezone: string } ``` |

## CSS shadow parts

| Part | Description |
| --- | --- |
| `nap` |  |
| `nap__add-time-range` | The add time range button |
| `nap__availability` | The availability container |
| `nap__content` | The content area of the availability picker |
| `nap__day` | The day container |
| `nap__error-message` | The error message for overlapping or invalid time ranges |
| `nap__header` | The header of the availability picker |
| `nap__remove-time-range` | The remove time range button |
| `nap__select-timezone` | The timezone selection container |
| `nap__select-timezone-button` | The timezone selection button |
| `nap__select-timezone-dropdown-content` | The timezone selection dropdown content |
| `nap__time-picker-container` | The time picker container |
| `nap__time-picker-input` | The time picker input |
| `nap__time-picker-times` | The time picker times |
| `nap__time-range` | The time range container |
| `nap__time-ranges` | The time ranges container |
| `nap__unavailable` | The unavailable label shown when a day has no time ranges |

## Dependencies

This component uses the following child components:

- [`<tooltip-component>`](/docs/reference/ui/tooltip-component/)
- [`<info-icon>`](/docs/reference/ui/info-icon/)
- [`<select-dropdown>`](/docs/reference/ui/select-dropdown/)
- [`<globe-icon>`](/docs/reference/ui/globe-icon/)
- [`<nylas-time-window-picker>`](/docs/reference/ui/time-window-picker/)
- [`<close-icon>`](/docs/reference/ui/close-icon/)
- [`<add-circle-icon>`](/docs/reference/ui/add-circle-icon/)

## Used by

This component is used inside:

- [`<nylas-editor-tabs>`](/docs/reference/ui/editor-tabs/)
- [`<nylas-participants-custom-availability>`](/docs/reference/ui/participants-custom-availability/)
