Alert

Status messages with typed intent, title, description, and icon slots.

Source
app/components/nitro_kit/alert.rb
API
NitroKit::Alert.new(variant:) { |alert| alert.title; alert.description }

Variants

Every semantic intent stays visible in data while retaining the native alert role.

Intent matrix

Default
Warning
Error
Success
ViewportFull width
Rubytest/dummy/app/components/gallery/components/alert_page.rb
Gallery::Data.alert_variants.each do |alert|
  sample(alert.variant.to_s.humanize, slug: alert.slug) do
    render_alert(alert)
  end
end

Content modes

Title, description, icon, and nested content are optional independent slots.

Slot combinations

Title only
Description only
Icon and title
Nested status
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/alert_page.rb
sample("Title only", slug: "title-only") do
  render NitroKit::Alert.new(id: "gallery-alert-title-only") do |alert|
    alert.title("Scheduled maintenance")
  end
end
sample("Description only", slug: "description-only") do
  render NitroKit::Alert.new(id: "gallery-alert-description-only") do |alert|
    alert.description("New sign-ins require a recovery code for the next 24 hours.")
  end
end
sample("Icon and title", slug: "icon-title") do
  render NitroKit::Alert.new(id: "gallery-alert-icon-title", variant: :success) do |alert|
    alert.icon(NitroKit::Icon.new(:circle_check, id: "gallery-alert-icon-title-icon"))
    alert.title("All systems operational")
  end
end
sample("Nested status", slug: "nested-status") do
  render NitroKit::Alert.new(id: "gallery-alert-nested-status") do |alert|
    alert.title("Production release")
    alert.description do
      render NitroKit::Badge.new(
        "Deploying",
        id: "gallery-alert-deploying-badge",
        color: :info,
        size: :sm
      )
    end
  end
end

Long content

Operational messages remain readable when product copy is specific and multi-line.

Detailed incident

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/alert_page.rb
render NitroKit::Alert.new(id: "gallery-alert-long", variant: :error) do |alert|
  alert.icon(NitroKit::Icon.new(:circle_x, id: "gallery-alert-long-icon"))
  alert.title("Production deployment could not complete after the database migration timed out")
  alert.description do
    "Existing traffic is still served by release 2026.07.12. Review the migration log, resolve the " \
      "lock contention, and retry the deploy when the primary database is healthy."
  end
end

Notification composition

Card, Alert, Icon, Badge, AvatarStack, and Avatar compose into a realistic release notice.

Release notification

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/alert_page.rb
render NitroKit::Card.new(id: "gallery-alert-notification-card") do |card|
  card.title("Release 2026.07.13", level: 3)
  card.body do
    render NitroKit::Alert.new(
      id: "gallery-alert-notification-success",
      variant: :success
    ) do |alert|
      alert.icon(
        NitroKit::Icon.new(:circle_check, id: "gallery-alert-notification-success-icon")
      )
      alert.title("Production deployment completed")
      alert.description("The release is serving all workspaces in Europe and North America.")
    end
  end
  card.footer do
    render NitroKit::Badge.new(
      "Production",
      id: "gallery-alert-notification-badge",
      color: :success,
      size: :sm
    )
    render NitroKit::AvatarStack.new(
      id: "gallery-alert-notification-reviewers",
      size: :sm,
      aria: { label: "Release reviewers" }
    ) do |stack|
      stack.avatar(alt: "Ada Lovelace", fallback: "AL", id: "gallery-alert-reviewer-ada")
      stack.avatar(alt: "Grace Hopper", fallback: "GH", id: "gallery-alert-reviewer-grace")
      stack.overflow(2)
    end
  end
end