Skip to content

Conversation

@karinevieira
Copy link
Contributor

Phlex 2.0 follows a specific folder structure and naming convention for views and components.

For views, they should be placed in the app/views directory under the Views namespace, and must inherit from Views::Base.

# frozen_string_literal: true

class Views::Articles::Index < Views::Base
  def view_template
    h1 { "Articles" }
  end
end

For components, they should be placed in the app/components directory under the Components namespace, and must inherit from Components::Base.

class Components::Button < Components::Base
  def view_template
    button { "Click me" }
  end
end

This pull request begins migrating the components that are currently in the app/views/components folder to app/components, in accordance with the Phlex conventions.

@stephannv stephannv merged commit 071b0a7 into ruby-ui:main Feb 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants