Empty state

An explicit empty result with controlled heading hierarchy, icon, and up to two actions.

Source
EmptyState is content, not application policy: callers choose copy, destinations, and whether zero, one, or two actions are appropriate.
API
Supply the required title through title: or title { ... }; description supports the same two forms. level: accepts 2..6. icon accepts one Icon and action accepts at most two distinct Buttons.

Optional content and actions

Heading levels, optional icon and description, and zero through two typed actions.

Title only

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/blocks/empty_state_page.rb
render NitroKit::EmptyState.new(title: "No records", id: "gallery-empty-state-title-only")

Informational

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/blocks/empty_state_page.rb
render NitroKit::EmptyState.new(
  title: "No API activity yet",
  description: "Requests will appear after a credential makes its first call.",
  id: "gallery-empty-state-information"
) do |empty|
  empty.icon NitroKit::Icon.new(:activity)
end

Primary action

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/blocks/empty_state_page.rb
render NitroKit::EmptyState.new(
  title: "No teammates yet",
  description: "Invite the first collaborator when the workspace is ready.",
  id: "gallery-empty-state-one-action"
) do |empty|
  empty.icon NitroKit::Icon.new(:users)
  empty.action NitroKit::Button.new("Invite teammate", href: "#invite", variant: :primary)
end

Primary and escape actions

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/blocks/empty_state_page.rb
render NitroKit::EmptyState.new(
  title: "No matching invoices",
  description: "Change the date range or clear every filter to return to invoice history.",
  id: "gallery-empty-state-two-actions"
) do |empty|
  empty.icon NitroKit::Icon.new(:search_x)
  empty.action NitroKit::Button.new("Clear filters", href: "#clear", variant: :primary)
  empty.action NitroKit::Button.new("Return to billing", href: "#billing")
end

Long nested empty state

ViewportFull width
Rubytest/dummy/app/components/gallery/blocks/empty_state_page.rb
render NitroKit::Container.new(size: :md, id: "gallery-empty-state-long-container") do
  render NitroKit::EmptyState.new(
    level: 4,
    id: "gallery-empty-state-long"
  ) do |empty|
    empty.title do
      plain "No records for "
      strong { "International Research, Production, and Reliability Engineering" }
    end
    empty.description do
      plain "The current search includes archived projects, suspended members, expired credentials, and a date range that predates this workspace. "
      plain "Remove one or more filters before trying again."
    end
    empty.icon NitroKit::Icon.new(:database)
    empty.action NitroKit::Button.new("Reset all filters", href: "#reset", variant: :primary)
    empty.action NitroKit::Button.new("Review query guide", href: "#guide")
  end
end