Command palette

@yasinsensoy/native

React Native · Components

EmptyState

Screen for an empty list, a search with no results, an error, offline or unauthorized state.

4 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

Nothing here yet

Code

import { EmptyState, Button } from "@yasinsensoy/native";

<EmptyState variant="dashed"
  action={<Button>Yeni ekle</Button>} />

Events

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

Import

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

EmptyState

component

Screen for an empty list, a search with no results, an error, offline or unauthorized state. Built-in states come with texts in the current language.

EmptyState({ preset, title, description, icon, image, action, secondaryAction, tone: toneProp, variant: variantProp, effect, size: sizeProp, align, children, style, }: EmptyStateProps): JSX.Element

Examples

<EmptyState preset="search" action={<Button variant="outline" onPress={clearFilters}>Clear filters</Button>} />
<EmptyState title="No orders yet" icon="inbox" variant="dashed" action={<Button>Start shopping</Button>} />

Built-in empty states: icon, color and text come together (same as web).

type EmptyStatePreset = "empty" | "search" | "error" | "offline" | "noAccess"

Variant: borderless, a dashed box or a card.

type EmptyStateVariant = "plain" | "dashed" | "card"

Props of EmptyState.

NameTypeDefaultDescription
preset?EmptyStatePreset"empty"Built-in state.
title?ReactNodeTitle; defaults to the built-in state's text.
description?ReactNodeDescription; defaults to the built-in state's text.
icon?IconProp | nullIcon; null for none.
image?ReactNodeAn image instead of the icon (e.g. <Image />).
action?ReactNodePrimary action (e.g. <Button>Add product</Button>).
secondaryAction?ReactNodeSecondary action.
tone?ToneColor of the icon background; defaults to the built-in state's.
variant?EmptyStateVariant | (string & {})"plain"Variant: one of the built-in variants or a name added with appearance.variants.emptyState.
effect?EffectPropEffect or effects. Defaults to appearance.defaults.emptyState.effect. See BuiltinEffect.
size?Size"md"Size.
align?"center" | "start""center"Alignment.
children?ReactNodeExtra content below the actions.
style?StyleProp<ViewStyle>Container style.