class DS::EmptyState < DesignSystemComponent # Centered empty / no-data / disabled state: icon, title, optional # description, optional action slot. Replaces the repeated # `text-center py-12 + icon + title + description + CTA` markup across the # empty screens (#2137), and gives the bare-text feature-disabled pages a real # state instead of unstyled top-left text. # # <%= render DS::EmptyState.new(icon: "repeat", title: "...", description: "...") do |es| %> # <% es.with_action do %><%= render DS::Link.new(...) %><% end %> # <% end %> renders_one :action def initialize(icon:, title:, description: nil, icon_size: "xl", **opts) @icon = icon @title = title @description = description @icon_size = icon_size @opts = opts end erb_template <<~ERB <%= content_tag :div, class: class_names("flex flex-col items-center text-center px-4 py-12", @opts[:class]), **@opts.except(:class) do %>
<%= helpers.icon(@icon, size: @icon_size) %>

<%= @title %>

<% if @description.present? %>

"><%= @description %>

<% end %> <% if action? %>
<%= action %>
<% end %> <% end %> ERB end