Class: Shadcn::SeparatorComponent

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

Overview

Separator component for visually dividing content Matches shadcn/ui Separator component

Examples:

Horizontal separator

<%= render Shadcn::SeparatorComponent.new %>

Vertical separator

<%= render Shadcn::SeparatorComponent.new(orientation: :vertical) %>

Decorative separator (no semantic meaning)

<%= render Shadcn::SeparatorComponent.new(decorative: true) %>

Constant Summary collapse

ORIENTATIONS =
{
  horizontal: "h-[1px] w-full",
  vertical: "h-full w-[1px]"
}.freeze
BASE_CLASSES =
"shrink-0 bg-border"

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(orientation: :horizontal, decorative: false, **options) ⇒ SeparatorComponent

Returns a new instance of SeparatorComponent.

Parameters:

  • orientation (Symbol) (defaults to: :horizontal)

    Separator orientation (:horizontal, :vertical)

  • decorative (Boolean) (defaults to: false)

    Whether the separator is purely decorative



26
27
28
29
30
# File 'app/components/shadcn/separator_component.rb', line 26

def initialize(orientation: :horizontal, decorative: false, **options)
  super(**options)
  @orientation = orientation.to_sym
  @decorative = decorative
end