# @gluestack-ui/toast

> A universal headless toast component for React Native, Next.js & React

Latest version **1.0.9** (published 2025-02-19) · 0 weekly downloads

## Install

```sh
npm install @gluestack-ui/toast
pnpm add @gluestack-ui/toast
yarn add @gluestack-ui/toast
bun add @gluestack-ui/toast
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2025-02-19 |
| First published | 2023-02-21 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 38.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5308 |
| Maintainers | vidhi499, rohit_singh, viraj-10, rayan1810, rajat693, surajahmedc, meenumakkar, madhavb230100, vaibhk002, daminipandey, amars29, geekgautam, sravankumarvelangi, gluestackadmin, geekashwini, mayankp06 |
| Keywords | react, native, react-native, toast, gluestack-ui, universal, headless, typescript, component, android, ios, nextjs |

## Links

- npm: https://www.npmjs.com/package/@gluestack-ui/toast
- Repository: https://github.com/gluestack/gluestack-ui
- Homepage: https://github.com/gluestack/gluestack-ui/tree/main/packages/unstyled/toast#readme
- Issues: https://github.com/gluestack/gluestack-ui/issues
- npm.io page: https://npm.io/package/@gluestack-ui/toast

## Dependencies (5)

- [@gluestack-ui/hooks](https://npm.io/package/@gluestack-ui/hooks.md) 0.1.13
- [@gluestack-ui/utils](https://npm.io/package/@gluestack-ui/utils.md) ^0.1.14
- [@gluestack-ui/overlay](https://npm.io/package/@gluestack-ui/overlay.md) ^0.1.20
- [@react-native-aria/focus](https://npm.io/package/@react-native-aria/focus.md) ^0.2.9
- [@gluestack-ui/transitions](https://npm.io/package/@gluestack-ui/transitions.md) ^0.1.11

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2025-02-19
- 1.0.2-alpha (alpha) — 2023-11-30
- 1.0.8 — 2024-11-11
- 1.0.7 — 2024-07-12
- 1.0.6 — 2024-07-12
- 1.0.5 — 2024-07-08
- 1.0.4 — 2024-01-23
- 1.0.3 — 2023-12-27
- 1.0.2 — 2023-12-01
- 1.0.1 — 2023-11-28
- 1.0.0 — 2023-11-28
- 1.0.0-alpha.0 — 2023-11-27
- 0.1.20 — 2023-10-20
- 0.1.19 — 2023-10-19
- 0.1.18 — 2023-10-19
- … 20 more at https://npm.io/package/@gluestack-ui/toast/versions

## README

# @gluestack-style/toast

## Installation

To use `@gluestack-ui/toast`, all you need to do is install the
`@gluestack-ui/toast` package:

```sh
$ yarn add @gluestack-ui/toast

# or

$ npm i @gluestack-ui/toast
```

## Usage

Toast is a component that can display alerts, notifications, or messages on top of an overlay layer. It is commonly used to inform users of important information or actions. Here's an example how to use this package to create one:

```jsx
import { Root, Title, Description } from './styled-components';
import { createToast, createToastHook } from '@gluestack-ui/toast';

export const toast = createtoast({
  Root,
  Title,
  Description,
});
```

## Customizing the toast:

Default styling of all these components can be found in the components/core/toast file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/development/example/storybook/src/ui-components/toast/index.tsx) of the styled `toast` components.

```jsx
// import the styles
import {
  Root,
  Title,
  Description,
} from '../components/core/toast/styled-components';

// import the createtoast and createToastHook function
import { createToast, createToastHook } from '@gluestack-ui/toast';

// Understanding the API
export const toast = createtoast({
  Root,
  Title,
  Description,
});

const useToast = createToastHook(Toast);

// Using the toast component
export default () => {
  const toast = useToast();
  return (
    <Button
      {...props}
      onPress={() => {
        toast.show({
          placement: placement,
          render: ({ id }) => {
            return (
              <Toast nativeId={id}>
                <ToastTitle>Hello World Toast {id}</ToastTitle>
              </Toast>
            );
          },
        });
      }}
    >
      <ButtonText>Press Me</ButtonText>
    </Button>
  );
};
```

More guides on how to get started are available
[here](https://ui.gluestack.io/docs/components/feedback/toast).

---
_Source: https://npm.io/package/@gluestack-ui/toast · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
