cosmos icon indicating copy to clipboard operation
cosmos copied to clipboard

repeated 'name' attribute in Checkbox docs

Open rakhi2104 opened this issue 7 years ago • 6 comments
trafficstars

Describe the bug In docs, the "name" attribute for the checkbox is repeated if the name value is user defined

Expected behavior Replace the previous value of the "name" attribute.

Screenshots screenshot from 2018-10-28 17-23-02

rakhi2104 avatar Oct 28 '18 12:10 rakhi2104

@rakhi2104 can I take up this issue?

gutsytechster avatar Oct 29 '18 13:10 gutsytechster

I'm actually working on this. :space_invader: Oops !

rakhi2104 avatar Oct 29 '18 14:10 rakhi2104

Ok no problem :)

gutsytechster avatar Oct 29 '18 14:10 gutsytechster

@siddharthkp, the name="example" is in the checkbox.md which is being rendered on the playground. We need to do a specific workaround for this checkbox item. All other components, to my knowledge, are free of this bug.

rakhi2104 avatar Nov 03 '18 04:11 rakhi2104

Found out that the select component also has the same problem screenshot from 2018-11-03 10-30-03

rakhi2104 avatar Nov 03 '18 05:11 rakhi2104

Hey!

This isn't documented in the contribution guide but we do a way of writing code that works with the prop table

Note: It's part of the codebase is super hacky and scheduled for a rewrite

Adding {props} connects it to the prop table

Adding defaults let's you pass values that used for the example and can be changed from the prop table (supports only number/string props right now)

Other props that you add are hardcoded and will create duplicates when changed in the prop table

Example:

<Select
  {props} defaults={{placeholder: ""Select an option..."}}
  options={[
    { text: 'One', value: 1 },
    { text: 'Two', value: 2 },
    { text: 'Three', value: 3 }
  ]}
  onChange={ event => console.log(event) }
/>

siddharthkp avatar Nov 05 '18 11:11 siddharthkp