Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add MarkdownAlert Style Switcher #1900

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

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
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.

1 participant