1
0
Fork 0
mirror of https://github.com/chobbledotcom/chobble-forms.git synced 2025-08-20 17:49:52 +00:00
An opinionated way of doing semantic HTML forms in Rails that forces you to use i18n strings and nicely match your database
Find a file
github-actions[bot] a328666c94 Bump version to 0.7.2
2025-08-17 01:39:55 +00:00
.github/workflows Reorganise files 2025-07-29 01:45:49 +01:00
app Wider numbers 2025-08-12 14:21:24 +01:00
bin Move out of play-test 2025-07-29 01:10:26 +01:00
lib Bump version to 0.7.2 2025-08-17 01:39:55 +00:00
sig Add Sorbet strong typing and type signatures to ChobbleForms gem with README updates (#6) 2025-08-13 18:28:10 +00:00
sorbet Add Sorbet strong typing and type signatures to ChobbleForms gem with README updates (#6) 2025-08-13 18:28:10 +00:00
spec Apply Standard Ruby autofixes 2025-08-16 22:51:48 +00:00
views/chobble_forms Fix tests by having fancier mocks 2025-08-16 23:51:26 +01:00
.gitignore Enforce strict symbol types for form field names with updated type alias and relaxed naming enforcement (#7) 2025-08-16 08:38:26 +00:00
chobble-forms.gemspec Require Rails 8 2025-08-07 15:31:52 +01:00
flake.lock Move out of play-test 2025-07-29 01:10:26 +01:00
flake.nix Add Sorbet type signatures, type checking support, and integration specs (#3) 2025-08-04 22:12:57 +00:00
Gemfile Move out of play-test 2025-07-29 01:10:26 +01:00
Gemfile.lock Bump version to 0.7.2 2025-08-17 01:39:55 +00:00
Rakefile Add Sorbet type signatures, type checking support, and integration specs (#3) 2025-08-04 22:12:57 +00:00
README.md Add Sorbet strong typing and type signatures to ChobbleForms gem with README updates (#6) 2025-08-13 18:28:10 +00:00
terragon-setup.sh Add Sorbet type signatures, type checking support, and integration specs (#3) 2025-08-04 22:12:57 +00:00

Chobble Forms

Semantic Rails forms with strict i18n enforcement.

Installation

Add this line to your application's Gemfile:

gem 'chobble-forms'

And then execute:

bundle install

Type Safety with Sorbet

ChobbleForms is fully typed with Sorbet (typed: strict) providing compile-time type safety and runtime validation. All field parameters must be symbols for a clean, consistent API.

Type Checking

bundle exec srb tc

Development Setup

  1. Install dependencies: bundle install
  2. Generate RBI files: bundle exec rake sorbet_rbi
  3. Run type checking: bundle exec rake typecheck

CSS Styles

ChobbleForms includes CSS for styling the form components. To use the included styles, add this to your application.css:

/*
 *= require chobble_forms
 */

The CSS includes:

  • Form Grids: Responsive grid layouts for various form field combinations
  • Form Fields: Styling for inputs, textareas, and labels
  • Radio Buttons: Custom radio button appearance with pass/fail color coding
  • Flash Messages: Styled success, error, notice, and alert messages

CSS Variables

The CSS uses the following CSS variables that you can override in your application:

  • --color-primary: Primary color for hover states (default: #118bee)
  • --color-pass: Pass/success color (default: #00a94f)
  • --color-fail: Fail/error color (default: #d32f2f)
  • --color-disabled: Disabled state color (default: #959495)