# Cycle select

Source: https://ecosphere.dev/docs/forms/cycle-select (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

The header control that says which cycle, year or term the whole screen is showing.

`import { EcoCycleSelect } from "vue-ecosphere"`

## Cycle

Put it first in pacts, ahead of the buttons: scope is read before action.

Vue (vue-ecosphere):

```vue
<EcoCycleSelect v-model="cycle" label="Cycle" :options="[
  { label: '2027–28', value: '2027' },
  { label: '2026–27', value: '2026' },
  { label: '2025–26', value: '2025' },
]" />
```

React (react-ecosphere):

```tsx
const [cycle, setCycle] = useState<string | null>("2027");

<EcoCycleSelect value={cycle} onChange={setCycle} label="Cycle" options={[
  { label: "2027–28", value: "2027" },
  { label: "2026–27", value: "2026" },
  { label: "2025–26", value: "2025" },
]} />
```

## Other scopes

Vue (vue-ecosphere):

```vue
<EcoCycleSelect v-model="term" label="Term" :options="terms" />
<EcoCycleSelect v-model="year" label="Year" :options="years" />
```

React (react-ecosphere):

```tsx
const [term, setTerm] = useState<number | null>(2);
const [year, setYear] = useState<string | null>("2026");

<EcoCycleSelect value={term} onChange={setTerm} label="Term" options={terms} />
<EcoCycleSelect value={year} onChange={setYear} label="Year" options={years} />
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `v-model` | `string \| number \| null` | null | The scope the screen shows. |
| `v-model:open` | `boolean` | false | Whether the menu is open. |
| `label` | `string` | — | The key inside the button in small caps: Cycle, Term, Year. |
| `options` | `EcoOption[]` | — | { label, value, disabled? } |
| `disabled` | `boolean` | false | Disable the trigger. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value / onChange` | `string \| number \| null` | null | The scope the screen shows. |
| `open / onOpenChange` | `boolean` | false | Whether the menu is open. |
| `label` | `string` | — | The key inside the button in small caps: Cycle, Term, Year. |
| `options` | `EcoOption[]` | — | { label, value, disabled? } |
| `disabled` | `boolean` | false | Disable the trigger. |
