Skip to content

Conversation

@djalmaaraujo
Copy link
Contributor

@djalmaaraujo djalmaaraujo commented Dec 10, 2025

Related issue

Related to #334

Description

This PR adds documentation files for the first batch of 9 components:

  • Accordion - A vertically stacked set of interactive headings that each reveal a section of content
  • Alert - Displays a callout for user attention (with variants: default, warning, destructive, success)
  • Alert Dialog - A modal dialog that interrupts the user with important content and expects a response
  • Aspect Ratio - Displays content within a desired ratio (16/9, 4/3, 1/1, 21/9)
  • Avatar - An image element with a fallback for representing the user (with multiple sizes)
  • Badge - Displays a badge with multiple variants and colors
  • Breadcrumb - Indicates the user's current location within a navigational hierarchy
  • Calendar - A date field component that allows users to enter and edit date
  • Card - Displays a card with header, content, and footer

These documentation files are installed via bin/rails g ruby_ui:install:docs and allow users to see component examples and usage patterns.

Testing instructions

Execute the following tests with a Rails app that has ruby_ui installed:

  1. Point your Rails app to the local ruby_ui source in Gemfile:

    gem "ruby_ui", path: "../ruby_ui"
  2. If you have any existing docs files, remove them to test fresh installation:

    rm -f app/views/docs/accordion.rb
    rm -f app/views/docs/alert.rb
    rm -f app/views/docs/alert_dialog.rb
    rm -f app/views/docs/aspect_ratio.rb
    rm -f app/views/docs/avatar.rb
    rm -f app/views/docs/badge.rb
    rm -f app/views/docs/breadcrumb.rb
    rm -f app/views/docs/calendar.rb
    rm -f app/views/docs/card.rb
  3. Run the docs generator:

    bin/rails g ruby_ui:install:docs
  4. Verify that all docs files were created:

    • app/views/docs/accordion.rb should exist
    • app/views/docs/alert.rb should exist
    • app/views/docs/alert_dialog.rb should exist
    • app/views/docs/aspect_ratio.rb should exist
    • app/views/docs/avatar.rb should exist
    • app/views/docs/badge.rb should exist
    • app/views/docs/breadcrumb.rb should exist
    • app/views/docs/calendar.rb should exist
    • app/views/docs/card.rb should exist
  5. Run tests in the ruby_ui repo:

    bundle exec rake

Add docs files for:
- accordion
- alert
- alert_dialog
- aspect_ratio
- avatar
- badge
- breadcrumb
- calendar
- card
@cirdes cirdes merged commit 9118639 into docs-generator Dec 11, 2025
2 checks passed
@cirdes cirdes deleted the docs/batch-1 branch December 11, 2025 17:33
cirdes pushed a commit that referenced this pull request Dec 11, 2025
* Add docs generator and button documentation

Introduce a new generator (`ruby_ui:install:docs`) that copies component
documentation files from the gem to Rails applications. Documentation
files follow the naming convention `{component}_docs.rb` and are copied
to `app/views/docs/` with the `_docs` suffix removed.

Usage:
  bin/rails g ruby_ui:install:docs
  bin/rails g ruby_ui:install:docs --force

Include stub classes for docs dependencies (Views::Base, Docs::Header,
Docs::VisualCodeExample, etc.) so docs files can be loaded without errors.
Rails apps can override these with full implementations.

Includes button component documentation as the first example.

* Add documentation for batch 1 components (#336)

Add docs files for:
- accordion
- alert
- alert_dialog
- aspect_ratio
- avatar
- badge
- breadcrumb
- calendar
- card
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.

3 participants