@net-advantage/jo-ui-button-group
v2.1.0
Published
Publishable button-group primitives package.
Readme
@net-advantage/jo-ui-button-group
Publishable button-group primitives package.
The group follows a strict MVVM split. The model projects each action. The view-model owns layout classes and the click callback. The view renders the view-model through Button.
MVVM
flowchart LR
Props["ButtonsProps"] --> ViewModel["useButtonsViewModel"]
Model["button.model.ts<br/>project each action"] --> ViewModel
ViewModel --> View["Button.tsx<br/>ButtonGroup"]
View -->|"onActionClick"| ViewModel
ViewModel -->|"onActionClick"| Host["Host application"]
View --> Button["jo-ui-button"]| Layer | File | Responsibility |
| --- | --- | --- |
| Contract | button.types.ts | Action, group props, item, and group view-model |
| Model | button.model.ts | Project a ButtonAction into a ButtonItemViewModel |
| View-model | button.view-model.ts | Framework-free group observable for direction, align, gap, and clicks |
| View | button.use-view-model.ts | useButtonsViewModel reads that observable |
| View | Button.tsx | Render the group from the view-model |
Models
flowchart TD
Props["ButtonsProps"] --> Action["ButtonAction"]
Action --> Item["ButtonItemViewModel"]
Item --> ViewModel["ButtonsViewModel"]
Props --> ViewModelButtonActionis the host item. It carries an id, label, and the button variant, size, icons, and disabled state.ButtonItemViewModelis that action after defaults are applied.directionisroworcolumn.alignisstart,center,end, orstretch.gapisxs,sm,md, orlg.- A click reports the action id. The group does not decide what the action does.
Structure
- src: runtime component, model, view-model, and types.
- stories: Storybook stories for documentation and visual testing.
Publish footprint
This package publishes only:
- dist
- README.md
Stories and tests are excluded from the published artifact by design.
