|
| 1 | +# Consistent Button and Form Control Sizing |
| 2 | + |
| 3 | +This document outlines the standardized sizing system implemented across all buttons and form controls using a **custom optimized sizing system** with **proportional font sizes** to ensure visual consistency throughout the application. |
| 4 | + |
| 5 | +## Size Variants - Custom Optimized System with Proportional Fonts |
| 6 | + |
| 7 | +The following size variants are available for both buttons and form controls, using carefully chosen heights with proportionally scaled font sizes: |
| 8 | + |
| 9 | +| Size | Class Suffix | Height | Font Size | Padding | |
| 10 | +|------|-------------|--------|-----------|---------| |
| 11 | +| Extra Small | `-xs` | 24px (1.5rem) | 11px (0.6875rem) | 0.125rem 0.5rem | |
| 12 | +| Small | `-sm` | 30px (1.875rem) | 13px (0.8125rem) | 0.25rem 0.75rem | |
| 13 | +| Default | _(none)_ | 38px (2.375rem) | 16px (1rem) | 0.325rem 0.565rem | |
| 14 | +| Large | `-lg` | 46px (2.875rem) | 18px (1.125rem) | 0.5rem 1rem | |
| 15 | +| Extra Large | `-xl` | 56px (3.5rem) | 20px (1.25rem) | 0.75rem 1.25rem | |
| 16 | + |
| 17 | +## Benefits of Custom Sizing System |
| 18 | + |
| 19 | +✅ **Proportional Font Scaling**: Font sizes scale harmoniously with height increases |
| 20 | +✅ **Balanced Increments**: Thoughtful progression from 24→30→38→46→56 |
| 21 | +✅ **Touch-Friendly**: All sizes meet accessibility guidelines for touch targets |
| 22 | +✅ **Visual Harmony**: Each size feels distinct yet proportionally related |
| 23 | +✅ **Readable Text**: Font sizes optimized for readability at each height |
| 24 | +✅ **Flexible**: Not constrained by rigid grid, optimized for your needs |
| 25 | + |
| 26 | +## Font Size Progression |
| 27 | + |
| 28 | +The font sizes follow a natural progression that maintains readability and visual balance: |
| 29 | + |
| 30 | +``` |
| 31 | +XS: 11px font in 24px container (46% ratio) |
| 32 | +SM: 13px font in 30px container (43% ratio) |
| 33 | +MD: 16px font in 38px container (42% ratio) |
| 34 | +LG: 18px font in 46px container (39% ratio) |
| 35 | +XL: 20px font in 56px container (36% ratio) |
| 36 | +``` |
| 37 | + |
| 38 | +## Visual Hierarchy |
| 39 | + |
| 40 | +``` |
| 41 | +XL (56px/20px) ████████████████████ Hero/CTA buttons, Primary actions |
| 42 | +LG (46px/18px) ████████████████ Important buttons, Form submissions |
| 43 | +MD (38px/16px) ████████████ Default buttons/inputs, Standard UI |
| 44 | +SM (30px/13px) ██████████ Dense layouts, Secondary actions |
| 45 | +XS (24px/11px) ████████ Compact interfaces, Icon buttons |
| 46 | +``` |
| 47 | + |
| 48 | +## Shared Variables |
| 49 | + |
| 50 | +The consistent sizing is achieved through shared SCSS variables defined in `src/scss/variables/_buttons.scss`: |
| 51 | + |
| 52 | +```scss |
| 53 | +// Size System - Custom Optimized Heights with Proportional Font Sizes |
| 54 | +// XS size - 24px height |
| 55 | +$input-btn-font-size-xs: 0.6875rem !default; // 11px - compact font for 24px height |
| 56 | +$input-btn-minheight-xs: 1.5rem !default; // 24px |
| 57 | +$input-btn-padding-xs: 0.125rem 0.5rem !default; |
| 58 | + |
| 59 | +// SM size - 30px height |
| 60 | +$input-btn-font-size-sm: 0.8125rem !default; // 13px - proportional to 30px height |
| 61 | +$input-btn-minheight-sm: 1.875rem !default; // 30px |
| 62 | +$input-btn-padding-sm: 0.25rem 0.75rem !default; |
| 63 | + |
| 64 | +// Base size - 38px height |
| 65 | +$input-btn-minheight: 2.375rem !default; // 38px |
| 66 | +// Default font size remains 1rem (16px) from _config.scss |
| 67 | + |
| 68 | +// LG size - 46px height |
| 69 | +$input-btn-font-size-lg: 1.125rem !default; // 18px - proportional to 46px height |
| 70 | +$input-btn-minheight-lg: 2.875rem !default; // 46px |
| 71 | +$input-btn-padding-lg: 0.5rem 1rem !default; |
| 72 | + |
| 73 | +// XL size - 56px height |
| 74 | +$input-btn-font-size-xl: 1.25rem !default; // 20px - proportional to 56px height |
| 75 | +$input-btn-minheight-xl: 3.5rem !default; // 56px |
| 76 | +$input-btn-padding-xl: 0.75rem 1.25rem !default; |
| 77 | +``` |
| 78 | + |
| 79 | +## Components Using Consistent Sizing |
| 80 | + |
| 81 | +### Buttons |
| 82 | +- Regular buttons (`.btn`, `.btn-xs`, `.btn-sm`, `.btn-lg`, `.btn-xl`) |
| 83 | +- Icon buttons (`.btn-icon`, `.btn-icon-xs`, `.btn-icon-sm`, `.btn-icon-lg`, `.btn-icon-xl`) |
| 84 | +- Button groups (`.btn-group-xs`, `.btn-group-sm`, `.btn-group-lg`, `.btn-group-xl`) |
| 85 | + |
| 86 | +### Form Controls |
| 87 | +- Text inputs (`.form-control`, `.form-control-xs`, `.form-control-sm`, `.form-control-lg`, `.form-control-xl`) |
| 88 | +- Select dropdowns (`.form-select`, `.form-select-xs`, `.form-select-sm`, `.form-select-lg`, `.form-select-xl`) |
| 89 | +- Input groups (`.input-group-xs`, `.input-group-sm`, `.input-group-lg`, `.input-group-xl`) |
| 90 | +- Checkboxes and radios (`.form-check-xs`, `.form-check-sm`, `.form-check-lg`, `.form-check-xl`) |
| 91 | + |
| 92 | +### Other Components |
| 93 | +- Navigation links with size variants |
| 94 | +- Dropdown items with size variants |
| 95 | + |
| 96 | +## Usage Examples |
| 97 | + |
| 98 | +### Buttons |
| 99 | +```html |
| 100 | +<button class="btn btn-primary btn-xs">Compact (24px/11px)</button> |
| 101 | +<button class="btn btn-primary btn-sm">Small (30px/13px)</button> |
| 102 | +<button class="btn btn-primary">Default (38px/16px)</button> |
| 103 | +<button class="btn btn-primary btn-lg">Large (46px/18px)</button> |
| 104 | +<button class="btn btn-primary btn-xl">Hero (56px/20px)</button> |
| 105 | +``` |
| 106 | + |
| 107 | +### Form Controls |
| 108 | +```html |
| 109 | +<input type="text" class="form-control form-control-xs" placeholder="Compact (24px/11px)"> |
| 110 | +<input type="text" class="form-control form-control-sm" placeholder="Small (30px/13px)"> |
| 111 | +<input type="text" class="form-control" placeholder="Default (38px/16px)"> |
| 112 | +<input type="text" class="form-control form-control-lg" placeholder="Large (46px/18px)"> |
| 113 | +<input type="text" class="form-control form-control-xl" placeholder="Hero (56px/20px)"> |
| 114 | +``` |
| 115 | + |
| 116 | +### Input Groups |
| 117 | +```html |
| 118 | +<div class="input-group input-group-sm"> |
| 119 | + <span class="input-group-text">@</span> |
| 120 | + <input type="text" class="form-control" placeholder="Username"> |
| 121 | + <button class="btn btn-primary" type="button">Go</button> |
| 122 | +</div> |
| 123 | +``` |
| 124 | + |
| 125 | +## Design Recommendations |
| 126 | + |
| 127 | +### When to Use Each Size: |
| 128 | + |
| 129 | +- **XS (24px/11px)**: Compact tables, toolbar buttons, dense layouts |
| 130 | +- **SM (30px/13px)**: Secondary actions, form controls in sidebars |
| 131 | +- **MD (38px/16px)**: Standard UI elements, most form controls |
| 132 | +- **LG (46px/18px)**: Primary actions, important form submissions |
| 133 | +- **XL (56px/20px)**: Hero buttons, call-to-actions, landing pages |
| 134 | + |
| 135 | +## Benefits |
| 136 | + |
| 137 | +1. **Visual Consistency**: All interactive elements maintain perfect proportional relationships |
| 138 | +2. **Proportional Scaling**: Font sizes scale harmoniously with container heights |
| 139 | +3. **Optimal Readability**: Each font size is optimized for its container size |
| 140 | +4. **Accessibility**: All sizes meet touch target guidelines (minimum 24px) |
| 141 | +5. **Balanced Progression**: Natural, comfortable size and font increments |
| 142 | +6. **Practical Design**: Focused on real-world usability and visual appeal |
| 143 | +7. **Design System**: Provides a solid foundation for a cohesive, professional design system |
| 144 | + |
| 145 | +## Files Modified |
| 146 | + |
| 147 | +- `src/scss/variables/_buttons.scss` - Updated shared sizing variables with proportional fonts |
| 148 | +- `src/scss/components/_buttons.scss` - Applied consistent sizing to buttons |
| 149 | +- `src/scss/components/forms/_form-control.scss` - Applied consistent sizing to form controls |
| 150 | +- `src/scss/components/forms/_form-select.scss` - Applied consistent sizing to select elements |
| 151 | +- `src/scss/components/forms/_input-group.scss` - Applied consistent sizing to input groups |
| 152 | +- `src/scss/components/forms/_form-check.scss` - Applied consistent sizing to checkboxes/radios |
0 commit comments