Command palette

@yasinsensoy/native

React Native · Components

Cascader

Cascading picker (same API as web's Cascader): leveled choices such as province → district → neighborhood or category → subcategory.

3 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Code

import { Cascader } from "@yasinsensoy/native";

<Cascader name="location" options={cities} loadChildren={ilceleriFetch} search clearable />

Events

  1. Events appear here when you interact with the preview.

Import

import { Cascader } from "@yasinsensoy/native";

Cascader

component

Cascading picker (same API as web's Cascader): leveled choices such as province → district → neighborhood or category → subcategory. On phones a single column in a bottom sheet, proceeding level by level and going back with the button at the top; on tablets columns open side by side.

  • Value: a path array (["istanbul", "kadikoy"]); the box shows "İstanbul / Kadıköy". With changeOnSelect intermediate levels are selectable too.
  • Loading: hasChildren options are fetched via loadChildren when opened; a spinner in the row, "Try again" on error.
  • Search: with search, across all loaded paths, insensitive to Turkish letters.
  • Form: bound inside Form via name.
Cascader(props: CascaderProps): ReactElement<unknown, string | JSXElementConstructor<any>>

Examples

<Cascader name="location" label="Location" options={provinces}
  loadChildren={(province, _path, signal) => fetchDistricts(province.value, signal)} />

An option in Cascader (same as web).

NameTypeDescription
valuestringUnique value at this level; the path is made of these values.
label?stringDisplay name. Defaults to value.
icon?IconPropIcon at the start of the name.
description?ReactNodeSmall description below the name.
children?readonly CascaderOption[]Child options.
hasChildren?booleanChild options are not loaded yet but exist; requested via loadChildren when opened.
disabled?booleanCannot be selected.

CascaderProps

interface

Props of Cascader (same names as web).

Extends: FieldProps

NameTypeDefaultDescription
optionsreadonly CascaderOption[]Option tree (e.g. province → district → neighborhood).
value?readonly string[]Selected path in controlled use (["istanbul", "kadikoy"]); [] for none.
defaultValue?readonly string[]Initial path in uncontrolled use.
onValueChange?(path: string[], options: CascaderOption[]) => voidWhen the selection changes, with the path and the options on it ([] when cleared).
loadChildren?(option: CascaderOption, path: readonly CascaderOption[], signal: AbortSignal) => Promise<readonly CascaderOption[]>Fetches child options when a hasChildren option is opened. The result is kept; on error "Try again" appears.
changeOnSelect?booleanfalseCan intermediate levels be selected too?
search?booleanfalseSearch box: searches all loaded paths ("kadı" → "İstanbul / Kadıköy").
separator?string" / "Separator of the path in the box.
renderValue?(options: CascaderOption[]) => ReactNodeHow the path appears in the box.
placeholder?string"Seçiniz"Text shown when nothing is selected.
icon?IconPropIcon at the start of the box.
clearable?booleanfalseClear button.
variant?FieldVariant"outline"Field variant.
open?booleanWhether the panel is open, for controlled use.
onOpenChange?(open: boolean) => voidWhen the panel opens or closes.
aria-label?stringScreen reader name; give it if there is no visible label.
style?StyleProp<ViewStyle>Container style.