Class: BetterUi::DividerComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- BetterUi::DividerComponent
- Defined in:
- app/components/better_ui/divider_component.rb
Overview
A divider component for visually separating content sections.
Renders a horizontal or vertical divider line with optional centered label text. Supports multiple border styles, color variants, sizes, and spacing options.
Constant Summary collapse
- ORIENTATIONS =
%i[horizontal vertical].freeze
- STYLES =
%i[solid dashed dotted].freeze
- SIZES =
%i[xs sm md].freeze
- LABEL_POSITIONS =
%i[left center right].freeze
- SPACINGS =
%i[xs sm md lg xl].freeze
Constants inherited from ApplicationComponent
ApplicationComponent::SHADOWS, ApplicationComponent::VARIANTS, ApplicationComponent::VARIANT_BODY_DIVIDE, ApplicationComponent::VARIANT_DIVIDE, ApplicationComponent::VARIANT_HEADER_BG, ApplicationComponent::VARIANT_HEADER_TEXT, ApplicationComponent::VARIANT_HIGHLIGHTED, ApplicationComponent::VARIANT_HOVERABLE, ApplicationComponent::VARIANT_RING, ApplicationComponent::VARIANT_SORT_ICON, ApplicationComponent::VARIANT_STRIPED
Instance Method Summary collapse
-
#initialize(orientation: :horizontal, style: :solid, variant: nil, size: :md, label: nil, label_position: :center, spacing: :md, container_classes: nil, **options) ⇒ DividerComponent
constructor
Initializes a new divider component.
Constructor Details
#initialize(orientation: :horizontal, style: :solid, variant: nil, size: :md, label: nil, label_position: :center, spacing: :md, container_classes: nil, **options) ⇒ DividerComponent
Initializes a new divider component.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/components/better_ui/divider_component.rb', line 46 def initialize( orientation: :horizontal, style: :solid, variant: nil, size: :md, label: nil, label_position: :center, spacing: :md, container_classes: nil, ** ) @orientation = validate_orientation(orientation) @style = validate_style(style) @variant = validate_variant(variant) if variant @size = validate_size(size) @label = label @label_position = validate_label_position(label_position) @spacing = validate_spacing(spacing) @container_classes = container_classes @options = end |