• Townie
    AI
  • Blog
  • Docs
  • Pricing
Log inSign up
damonb

damonb

react-hono-with-react-router

Remix of stevekrouse/react-hono-with-react-router
Unlisted
Like
react-hono-with-react-router
Home
Code
4
backend
1
frontend
6
.vtignore
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
frontend
/
components
/
README_Toast.md
Code
/
frontend
/
components
/
README_Toast.md
Search
7/5/2025
Viewing readonly version of main branch: v430
View latest version
README_Toast.md

Toast System

This project includes a global toast notification system that can be used from anywhere in the app.

Features

  • Global toast notifications
  • Three levels: info, warning, and error
  • Auto-dismiss after 5 seconds
  • Manual dismiss with close button
  • Smooth animations
  • Responsive design
  • TypeScript support

Usage

Basic Usage

Create val
import { useToast } from "./components/ToastProvider.tsx"; const MyComponent = () => { const { toast } = useToast(); const handleSuccess = () => { toast("Operation completed successfully!", "info"); }; const handleWarning = () => { toast("Please check your input", "warning"); }; const handleError = () => { toast("Something went wrong!", "error"); }; return ( <div> <button onClick={handleSuccess}>Show Success</button> <button onClick={handleWarning}>Show Warning</button> <button onClick={handleError}>Show Error</button> </div> ); };

Toast Levels

  • "info" - Blue background, information messages
  • "warning" - Yellow background, warning messages
  • "error" - Red background, error messages

API

The useToast hook returns an object with:

  • toast(message: string, level: ToastLevel) - Shows a toast notification
  • removeToast(id: string) - Manually removes a toast by ID

Toast Properties

Each toast has the following properties:

Create val
interface Toast { id: string; // Unique identifier message: string; // The message to display level: ToastLevel; // "info" | "warning" | "error" timestamp: number; // When the toast was created }

Setup

The toast system is already set up in your app. The ToastProvider wraps your entire application in index.tsx, making the useToast hook available throughout the component tree.

Styling

Toasts are styled with Tailwind CSS classes and appear in the top-right corner of the screen. They include:

  • Smooth slide-in/slide-out animations
  • Color-coded backgrounds based on level
  • Icons for each level
  • Close button
  • Responsive design
  • Shadow and border styling

Customization

You can customize the toast appearance by modifying the ToastItem component in Toast.tsx. The styling uses Tailwind CSS classes and can be easily adjusted.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.