Class: NitroKit::Component
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- NitroKit::Component
- Defined in:
- app/components/nitro_kit/component.rb
Direct Known Subclasses
Accordion, Alert, Avatar, AvatarStack, Badge, Button, ButtonGroup, Card, Checkbox, CheckboxGroup, Combobox, Datepicker, Dialog, Dropdown, Field, FieldGroup, Fieldset, Icon, Input, Label, Pagination, RadioButton, RadioButtonGroup, Select, Switch, Table, Tabs, Textarea, Toast, Toast::FlashMessages, Toast::Item, Tooltip
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Class Method Summary collapse
Instance Method Summary collapse
- #builder(&block) ⇒ Object
-
#initialize(attrs = {}, **defaults) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(attrs = {}, **defaults) ⇒ Component
Returns a new instance of Component.
5 6 7 |
# File 'app/components/nitro_kit/component.rb', line 5 def initialize(attrs = {}, **defaults) @attrs = merge_attrs(attrs, **defaults) end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
9 10 11 |
# File 'app/components/nitro_kit/component.rb', line 9 def attrs @attrs end |
Class Method Details
.from_template(*args, **attrs, &block) ⇒ Object
11 12 13 |
# File 'app/components/nitro_kit/component.rb', line 11 def self.from_template(*args, **attrs, &block) new(*args, **attrs, &block).tap { |instance| instance.instance_variable_set(:@_nk_from_template, true) } end |
Instance Method Details
#builder(&block) ⇒ Object
15 16 17 |
# File 'app/components/nitro_kit/component.rb', line 15 def builder(&block) @_nk_from_template ? capture(&block) : yield end |