Class: PhlexKit::List
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::List
- Defined in:
- app/components/phlex_kit/typography/list.rb
Overview
Prose list, ported from shadcn/ui's typography "list" style (ruby_ui's TypographyList). Renders a ul (or ol via as:) with the .pk-list styling that previously shipped as an orphaned utility class. Children are plain
Constant Summary collapse
- AS_TAGS =
as:is dispatched dynamically (send) — whitelist like Separator. %i[ul ol].freeze
Instance Method Summary collapse
-
#initialize(as: :ul, **attrs) ⇒ List
constructor
A new instance of List.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(as: :ul, **attrs) ⇒ List
Returns a new instance of List.
10 11 12 13 14 15 16 |
# File 'app/components/phlex_kit/typography/list.rb', line 10 def initialize(as: :ul, **attrs) @as = as.to_sym unless AS_TAGS.include?(@as) raise ArgumentError, "unknown List as: #{@as.inspect} (use one of #{AS_TAGS.join(", ")})" end @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
18 19 20 |
# File 'app/components/phlex_kit/typography/list.rb', line 18 def view_template(&) send(@as, **mix({ class: "pk-list" }, @attrs), &) end |