Snackbar
A temporary, controlled message inspired by the legacy Snackbar rather than by the v1 Toast queue. Several messages share a vertical anchor through Snackbar.Stack, so they never overlap.
Overview
A temporary, controlled message inspired by the legacy Snackbar rather than by the v1
Toast queue. Several messages share a vertical anchor through Snackbar.Stack, so they
never overlap.
First example
<Snackbar isVisible={isVisible} onVisibleChange={setVisible} duration={4000}><Snackbar.Message>Enregistré.</Snackbar.Message><Snackbar.Actions><Snackbar.Action onPress={undo}>Annuler</Snackbar.Action><Snackbar.Close asChild><Button variant="tertiary">Fermer</Button></Snackbar.Close></Snackbar.Actions></Snackbar>
Anatomy
Snackbarowns visibility and its timer, plus placement and portal when used alone.Snackbar.Stackowns one placement and portal for several snackbars, then lays them out vertically without overlap.Snackbar.Messageis the announcement.Snackbar.Actionsgroups trailing controls.Snackbar.Actionruns an action and dismisses by default.Snackbar.ActionLabelis the action text; raw action text is wrapped in it.Snackbar.Closeonly dismisses.
duration={0} keeps it visible. position, insetHorizontal, insetVertical, maxWidth
and isPortalled correspond to the legacy layout controls. The legacy message,
actionLabel, showCloseAffordance and customAppearance configuration props become
explicit slots and each slot accepts its own style props.
Inside Snackbar.Stack, each Snackbar keeps its own visibility, timer, content and actions;
the stack takes over placement, width and portalling. Its position, spacing,
insetHorizontal, insetVertical, maxWidth and isPortalled props control the shared
anchor. The last child stays closest to the selected edge: a bottom stack grows upward and
a top stack grows downward.
The root has the alert role and a polite live region. Entrance and exit run through
Reanimated.
Usage
<Snackbar isVisible={isVisible} onVisibleChange={setVisible} duration={4000}>
<Snackbar.Message>Enregistré.</Snackbar.Message>
<Snackbar.Actions>
<Snackbar.Action onPress={undo}>Annuler</Snackbar.Action>
<Snackbar.Close asChild>
<Button variant="tertiary">Fermer</Button>
</Snackbar.Close>
</Snackbar.Actions>
</Snackbar>
Several independently controlled messages go in one stack:
<Snackbar.Stack position="bottom" spacing={8}>
<Snackbar isVisible={saved}>Enregistré.</Snackbar>
<Snackbar isVisible={offline} variant="warning">
Connexion interrompue.
</Snackbar>
</Snackbar.Stack>
Root props
SnackbarProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
| variant | SnackbarVariant | undefined | No | — |
| color | string | undefined | No | A raw tint applied outside the recipe cache. |
| radius | RadiusKey | undefined | No | — |
| isVisible | boolean | undefined | No | — |
| defaultVisible | boolean | undefined | No | — |
| duration | number | undefined | No | — |
| onVisibleChange | ((isVisible: boolean) => void) | undefined | No | — |
| onClose | (() => void) | undefined | No | — |
| position | SnackbarPosition | undefined | No | — |
| insetHorizontal | number | undefined | No | — |
| insetVertical | number | undefined | No | — |
| maxWidth | number | undefined | No | — |
| isPortalled | boolean | undefined | No | — |
| asChild | boolean | undefined | No | — |
Slots
SnackbarActionLabelProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
SnackbarActionProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
| isCloseOnPress | boolean | undefined | No | — |
| asChild | boolean | undefined | No | — |
SnackbarActionsProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
SnackbarCloseProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
| asChild | boolean | undefined | No | — |
SnackbarMessageProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
SnackbarStackProps
The node's inherited React Native props apply too, and so do its style props — padding, margin, width and the rest.
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | No | — |
| position | SnackbarPosition | undefined | No | — |
| spacing | number | undefined | No | Space between consecutive snackbars. |
| insetHorizontal | number | undefined | No | — |
| insetVertical | number | undefined | No | — |
| maxWidth | number | undefined | No | — |
| isPortalled | boolean | undefined | No | — |
| asChild | boolean | undefined | No | — |