Module: UikitRails

Defined in:
lib/uikit_rails.rb,
lib/uikit_rails/engine.rb,
lib/uikit_rails/version.rb,
lib/uikit_rails/generators/add_generator.rb,
lib/uikit_rails/generators/install_generator.rb,
app/controllers/uikit_rails/styleguide_controller.rb

Overview

Copy-paste UI components for Rails, inspired by shadcn/ui.

Defined Under Namespace

Modules: Generators Classes: Engine, Error, StyleguideController

Constant Summary collapse

COMPONENTS =
%w[
  accordion
  alert
  alert_dialog
  avatar
  badge
  breadcrumb
  button
  card
  checkbox
  collapsible
  dialog
  dropdown
  form
  input
  label
  pagination
  popover
  progress
  select
  separator
  sheet
  skeleton
  switch
  table
  tabs
  textarea
  toast
  toggle
  tooltip
].freeze
VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.available_componentsObject



54
55
56
# File 'lib/uikit_rails.rb', line 54

def available_components
  COMPONENTS.select { |name| Dir.exist?(component_path(name)) }
end

.component_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/uikit_rails.rb', line 50

def component_exists?(name)
  COMPONENTS.include?(name) && Dir.exist?(component_path(name))
end

.component_path(name) ⇒ Object



42
43
44
# File 'lib/uikit_rails.rb', line 42

def component_path(name)
  File.join(templates_root, "components", name)
end

.templates_rootObject



46
47
48
# File 'lib/uikit_rails.rb', line 46

def templates_root
  File.expand_path("uikit_rails/templates", __dir__)
end