Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

<callout> element for callouts/alerts/admonitions #10100

Open
Labels
@LeaVerou

Description

@LeaVerou

What problem are you trying to solve?

Callouts (aka admonitions or alerts) like notes, tips, warnings, etc. are very common in documents. However, there is no clear way to mark them up correctly, and the ways authors devise often suffer from poor accessibility (talking about it with@matatk, it’s important that they are marked up with a sectioning element, so that screen reader users know where the callout ends, but plain divs are used more often than not).

What solutions exist today?

Every design system invents their own, and the vast majority use divs. A few examples:

How would you solve it?

An MVP could simply be a new<callout> element with proper semantics and some light base styling by default.

Ideally, you want this to provide more value to authors than semantics, to motivate them to use it. One wya to do that is to support a slot for labels, and an optionaltype attribute, with predefined values (note,tip,warning,example etc.) orcustom (which would be the default), and alabel attribute. The predefined callout types would produce an automatically localized label and slightly different styling. For things that require formatting, where an attribute is not sufficient, authors can use thelabel slot directly.

Later, we could increase the value proposition further, via anicon slot and anicon attribute, which can take either a string (for emojis), a URL, or certain keywords.

Anything else?

Prior art:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp