Skip to content

Conversation

hexart
Copy link
Contributor

@hexart hexart commented Feb 17, 2025

Add Alert Style Switcher

This PR introduces a configurable style switcher for alert components, allowing users to choose between classic and modern visual styles through configuration.

Features

  • Add alert_style configuration option in the UI settings
  • Support two style variants:
    • classic: Traditional left-border style (default)
    • modern: Rounded corners with softer borders and transparent background
  • Implement style switching through .chainlit/config.toml
  • Maintain backward compatibility with default classic style

Implementation

  • Added alert_style to UISettings dataclass with Literal type constraint
  • Extended configuration type definitions in frontend
  • Implemented style switching logic in MarkdownAlert component
  • Added modernVariantStyles with Tailwind classes for the new design

Usage

Users can switch alert styles by setting the following in their .chainlit/config.toml:

[UI]
alert_style = "modern"  # or "classic"

Screenshot

2025-02-17 11 18 20 2025-02-17 11 18 13

Notes

Default style remains "classic" for backward compatibility
All alert variants (info, warning, success, etc.) support both styles

- Add alert_style config option to switch between classic and modern styles
- Add modern style variant for alerts with rounded corners and softer borders
- Set default style to classic for backward compatibility
- Configure style through UI section in config.toml
@hexart hexart marked this pull request as ready for review February 17, 2025 05:48
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. frontend Pertains to the frontend. labels Feb 17, 2025
@hexart hexart changed the title feat(alert): Add Alert Style Switcher feat(alert): Add MarkdownAlert Style Switcher Feb 17, 2025
@hexart hexart changed the title feat(alert): Add MarkdownAlert Style Switcher feat: Add MarkdownAlert Style Switcher Feb 19, 2025
@hayescode hayescode added this pull request to the merge queue Jul 1, 2025
Merged via the queue into Chainlit:main with commit 214be3c Jul 1, 2025
8 checks passed
@hexart hexart deleted the feat/md-alert-style-selection branch July 1, 2025 04:46
This was referenced Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Pertains to the frontend. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants