Class: Shadcn::MenubarRadioItemComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/menubar_radio_item_component.rb

Overview

Menubar Radio Item component A radio button within a radio group

Constant Summary collapse

BASE_CLASSES =
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(value: nil, checked: false, disabled: false, **options, &block) ⇒ MenubarRadioItemComponent

Returns a new instance of MenubarRadioItemComponent.

Parameters:

  • value (String) (defaults to: nil)

    Value of this radio item

  • checked (Boolean) (defaults to: false)

    Whether item is selected

  • disabled (Boolean) (defaults to: false)

    Whether item is disabled



16
17
18
19
20
21
# File 'app/components/shadcn/menubar_radio_item_component.rb', line 16

def initialize(value: nil, checked: false, disabled: false, **options, &block)
  super(**options, &block)
  @value = value
  @checked = checked
  @disabled = disabled
end

Instance Method Details

#callObject



23
24
25
# File 'app/components/shadcn/menubar_radio_item_component.rb', line 23

def call
  (:div, item_content, item_attributes)
end