canvas-kit
canvas-kit copied to clipboard
Add example for Table column size adjustment
🚀 Feature Proposal
Add an example to the Table component docs to show a model for column size adjustment from Parent <Table>.
Motivation
Show users how to setup column sizing from parent <Table>.
Example
Per Rusty:
import { createModelHook } from '@workday/canvas-kit-react/common'
export const useTableModel = createModelHook({ defaultConfig: { columnSize: '' } })(config => {
return {
state: { columnSize: config.columnSize },
events: {},
}
})
<Table columnSize="repeat(3, minmax(4rem, 1fr)) minmax(4rem, .5fr) minmax(4rem, 1.5fr)">
Questions:
- What about
columnSizesthat takes an array? - Is this a good use of a model?
Will discuss with Rusty.
This can be an example.
Offering a bit of research from Salesforce: https://salesforce-ux.github.io/dnd-a11y-patterns/#/resize?_k=jcg0ue
Interesting idea here, using a slider input to help communicate a range of width for the column. I don't know if I like this for our tables that already have buttons in the column header... but it is still something cool that I hadn't considered.