Class: BetterUi::ContainerComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- BetterUi::ContainerComponent
- Defined in:
- app/components/better_ui/container_component.rb
Overview
A responsive container component for constraining content width.
This component provides a simple wrapper div with configurable max-width, horizontal padding, and centering. It is ideal for wrapping page content to maintain readable line lengths and consistent layout across breakpoints.
Constant Summary collapse
- SIZES =
Note:
Classes must be hardcoded strings for Tailwind JIT detection.
Available container sizes mapped to Tailwind max-width classes.
{ sm: "max-w-screen-sm", md: "max-w-screen-md", lg: "max-w-screen-lg", xl: "max-w-screen-xl", full: "max-w-full" }.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(size: :lg, padding: true, centered: true, container_classes: nil, **options) ⇒ ContainerComponent
constructor
Initializes a new container component.
Constructor Details
#initialize(size: :lg, padding: true, centered: true, container_classes: nil, **options) ⇒ ContainerComponent
Initializes a new container component.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/components/better_ui/container_component.rb', line 62 def initialize( size: :lg, padding: true, centered: true, container_classes: nil, ** ) @size = validate_size(size) @padding = padding @centered = centered @container_classes = container_classes @options = end |