3

I'm currently facing a problem with react-toolbox-checkboxes https://github.com/react-toolbox/react-toolbox/tree/dev/components/checkbox while trying to display them inline like this:

enter image description here

But all I can do is displaying them like this:

enter image description here

Code looks like this:

           <Checkbox
                checked={this.state.checkboxes[0].task}
                label={t('search:instance_template.task')}
                onChange={() => {
                    this.handleCheckboxChange(0, 'task')
                }}
            />

Styles like this:

input[type="checkbox"]{
    display: inline-block;
}

The checkboxes does receive classes and attributes but attributes like "display: inline-block" don't have any effect onto them. Any ideas? Thanks!

Nocebo
  • 1,927
  • 3
  • 15
  • 26

2 Answers2

2

Based on the comment of @Hash this is the result:

        <div id="instanceCheckboxes" style={{display: 'inline-flex', flexDirection: 'row'}}>
                <Checkbox
                    checked={this.state.checkboxes[0].task}
                    label={t('search:instance_template.task')}
                    onChange={() => {
                        this.handleCheckboxChange(0, 'task')
                    }}
                />
                ...
            </div>

It wasn't necessary to style the checkboxes directly. That's the result: enter image description here

Nocebo
  • 1,927
  • 3
  • 15
  • 26
2

[Reading Purposes] Linking two pages as well that will help on how each style works. Flexbox, CSSFlexbox

Sample related to question.

enter image description here

Hash
  • 7,726
  • 9
  • 34
  • 53