Success
Success state uses Ant Design's check-circle icon.
Order received
We will email you once the shipment is scheduled.
Code
<%= render(Hakumi::Result::Component.new(
id: "result-success",
status: :success,
title: "Order received",
sub_title: "We will email you once the shipment is scheduled.",
extra: render(Hakumi::Button::Component.new(type: :primary)) { "Back to orders" }
)) %>
Info
Informational status with the default info-circle icon.
Awaiting review
We’ll notify you once your submission has been approved.
Code
<%= render(Hakumi::Result::Component.new(
id: "result-info",
status: :info,
title: "Awaiting review",
sub_title: "We’ll notify you once your submission has been approved.",
extra: render(Hakumi::Button::Component.new(type: :link)) { "View submission" }
)) %>
Warning
Warning status highlighting required actions.
Action required
Review the highlighted information before proceeding.
Code
<%= render(Hakumi::Result::Component.new(
id: "result-warning",
status: :warning,
title: "Action required",
sub_title: "Review the highlighted information before proceeding.",
extra: render(Hakumi::Space::Component.new) do |space|
space.with_item { render(Hakumi::Button::Component.new(type: :primary)) { "Review details" } }
space.with_item { render(Hakumi::Button::Component.new) { "Dismiss" } }
end
)) %>
Error
Error status with additional supporting content.
Payment failed
We could not process your payment. Please update your card info and try again.
The system will keep this order on hold for 24 hours before cancelling it automatically.
Code
<%= render(Hakumi::Result::Component.new(
id: "result-error",
status: :error,
title: "Payment failed",
sub_title: "We could not process your payment. Please update your card info and try again.",
)) do %>
<%= render(Hakumi::Typography::Paragraph::Component.new(type: :secondary)) do %>
The system will keep this order on hold for 24 hours before cancelling it automatically.
<% end %>
<%= render(Hakumi::Space::Component.new(style: "margin-top: 16px;")) do |space| %>
<% space.with_item do %>
<%= render(Hakumi::Button::Component.new(type: :primary, danger: true)) { "Retry payment" } %>
<% end %>
<% space.with_item do %>
<%= render(Hakumi::Button::Component.new) { "Change method" } %>
<% end %>
<% end %>
<% end %>
Without icon
Hide the illustration by passing <code>icon: false</code>.
Action required
Review the highlighted items before continuing.
This variant hides the illustration entirely by passing
icon: false.
Code
<%= render(Hakumi::Result::Component.new(
id: "result-without-icon",
status: :warning,
title: "Action required",
sub_title: "Review the highlighted items before continuing.",
icon: false,
extra: render(Hakumi::Space::Component.new) do |space|
space.with_item do
render(Hakumi::Button::Component.new(type: :primary)) { "Resolve issues" }
end
space.with_item do
render(Hakumi::Button::Component.new) { "Dismiss" }
end
end
)) do %>
<%= render(Hakumi::Typography::Paragraph::Component.new(type: :secondary)) do %>
This variant hides the illustration entirely by passing <code>icon: false</code>.
<% end %>
<% end %>
Programmatic
Create results dynamically via <code>HakumiComponents.renderComponent</code>.
Code
<%= render(Hakumi::Space::Component.new) do |space| %>
<% space.with_item do %>
<%= render(Hakumi::Button::Component.new(id: "prog-result-create", type: :primary)) { "Create result (no SVG)" } %>
<% end %>
<% space.with_item do %>
<%= render(Hakumi::Button::Component.new(id: "prog-result-clear")) { "Clear results" } %>
<% end %>
<% end %>
<%= render(Hakumi::Flex::Component.new(
id: "result-programmatic-target",
vertical: true,
gap: "16px",
style: "margin-top: 16px;"
)) { "" } %>
<script>
(() => {
const wire = () => {
if (!window.HakumiComponents?.renderComponent) return false
const targetSelector = "#result-programmatic-target"
const createButton = document.getElementById("prog-result-create")
const clearButton = document.getElementById("prog-result-clear")
createButton?.addEventListener("click", () => {
window.HakumiComponents.renderComponent("result", {
params: {
status: "info",
icon: false,
title: "Programmatic result",
sub_title: `Generated at ${new Date().toLocaleTimeString()}`,
extra: "You can add actions here"
},
target: targetSelector,
mode: "append"
})
})
clearButton?.addEventListener("click", () => {
const target = document.querySelector(targetSelector)
if (target) target.innerHTML = ""
})
return true
}
if (wire()) return
const onReady = () => {
if (wire()) {
document.removeEventListener("turbo:load", onReady)
window.removeEventListener("load", onReady)
}
}
document.addEventListener("turbo:load", onReady)
window.addEventListener("load", onReady)
})()
</script>
Result API
| Prop | Type | Default | Description |
|---|---|---|---|
status |
Symbol or String |
:info |
Visual status (:success, :info, :warning, :error). |
title |
String or ViewComponent |
Status-based default |
Main title content. |
sub_title |
String or ViewComponent |
- |
Secondary text displayed below the title. |
icon |
String | ViewComponent or false |
Status illustration |
Custom illustration or false to hide the icon. |
extra |
String or ViewComponent |
- |
Extra action content rendered below the body. |
content slot |
Slot |
- |
Additional content rendered between subtitle and extra. |
**html_options |
Keyword args |
- |
Extra attributes merged into the wrapper div. |
JavaScript API (element.hakumiResult)
Result is a static component and does not expose a JavaScript API.
| Prop | Type | Default | Description |
|---|---|---|---|
- |
- |
- |
No public methods. |