Tabs
Tabs
Includes a Ruby component and corresponding Rails helper
RubyIncludes a Stimulus controller
StimulusExample
Hi I'm a general, at ease soldier
<%= nk_tabs(default: :general) do |t| %>
<%= t.tabs do %>
<%= t.tab(:general) { "Profile" } %>
<%= t.tab(:billing) { "Billing" } %>
<%= t.tab(:contact) { "Contact" } %>
<% end %>
<%= t.panel(:general) do %>
<div>Hi I'm a general, at ease soldier</div>
<% end %>
<%= t.panel(:billing) do %>
<div>Find that one receipt that your accountant asks for</div>
<% end %>
<%= t.panel(:contact) do %>
<div>How we can contact you when we screw up</div>
<% end %>
<% end %>
Usage
| ||
---|---|---|
Property | Default | Description |
default | nil | The initial tab to show. |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
**attrs | HTML attributes for <div> element |
| ||
---|---|---|
Property | Default | Description |
key | Required Unique identifier | |
text | nil | Plain text content |
**attrs | HTML attributes for <button> element |
| ||
---|---|---|
Property | Default | Description |
key | Required Unique identifier | |
**attrs | HTML attributes for <div> element |