Documentation

Rails Designer Initializer

After you installed Rails Designer you will find a new initializer (config/initializers/rails_designer.rb). This files holds various settings and preferences to make Rails Designer work for you.

Preferences

Settings around the internals for Rails Designer.

preview_enabled

Enables the Components Library (added via the routes.rb at /rails_designer/). Defaults to false.

enable_antialiasing_in_library_preview

If your app uses antialising (eg. antialiased), you can enable this so the Components Library matches your app.

post_generator_actions

Some components have additional actions assigned, eg. injecting a turbo-frame id="modal" element in your application layout for the modal component. You can disable these actions by setting it to false. Defaults to true.

base_controller

Set an alternative base controller for the Rails Designer library. Defaults to ApplicationController.

view_helpers

Rails Designer comes with a few helpers out-of-the-box to clean- and dry-up your code. It’s an array with the enabled helpers. Defaults to [] (no helpers enabled).

layouts_destination_directory

Set the default directory for the generated layouts.

disable_feedback_buttons

If you want to disable the feedback button in the bottom-left of the Components Library (because you already gave feedback or shared your product), you can set it to true. Defaults to false.

ViewComponent

Settings for ViewComponent files.

primary_color

Some components use a primary color. You can set your preferred color here. Should be one of Tailwind CSS’ default colors. Defaults to sky.

gray_color

Similar to the primary_color, you can set your preferred Tailwind CSS’ gray color. Defaults to gray.

components_destination_directory

By default the generated components are stored in app/components. Change it if you prefer a different destination.

component_module_name

If you want to add the components in a specific module, say RailsDesigner you can set it here. It’s important that the module matches the components_destination_directory. Example: if your module is RailsDesigner, the components_destination_directory should include this too, eg. app/components/rails_designer/.

component_base_class

Set a different base class for the Rails Designer components. If your app has a ApplicationComponent that is used, otherwise defaults to ViewComponent::Base.

Stimulus

Various settings around the Stimulus files.

stimulus_controller_destination_directory

Set a different directory for the included stimulus controllers (and its helpers). Default is app/javascript/controllers/.

stimulus_controller_parent_controller

Choose a different parent controller for the Stimulus controller, eg. ApplicationController. Defaults to Controller.

stimulus_controller_parent_module_name

Pointer to the parent controller, eg. ./application_controller. Defaults to @hotwired/stimulus.