canvas-kit icon indicating copy to clipboard operation
canvas-kit copied to clipboard

Add example for Table column size adjustment

Open josh-bagwell opened this issue 2 years ago • 3 comments

🚀 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)">

josh-bagwell avatar May 09 '23 19:05 josh-bagwell

Questions:

  • What about columnSizes that takes an array?
  • Is this a good use of a model?

alanbsmith avatar May 31 '23 17:05 alanbsmith

Will discuss with Rusty.

This can be an example.

josh-bagwell avatar Jun 01 '23 20:06 josh-bagwell

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.

williamjstanton avatar Nov 16 '23 14:11 williamjstanton