Michaël Maillot
Michaël Maillot

Reputation: 151

how to customize Office UI Fabric React Dialog CSS?

I want to add some style properties inside my Dialog Component (like put a margin for a textbox) but my classes are not referenced on the render

HelloWorld.tsx

import styles from './HelloWorld.module.scss';

<Dialog
hidden={false}
dialogContentProps={{
  type: DialogType.normal,
  title: "My Dialog",
  className: styles.dialogadd,
}}
modalProps={{
  isBlocking: false,
  className: styles.dialogadd,
}}>

<div className={styles.permcheck}>
  <Checkbox label="Test 1" />
  <Checkbox label="Test 2" />
  <Checkbox label="Test 3" />
</div>

HelloWorld.module.scss

.dialogadd {
    font-size: 20px;
  }

  .permcheck {
    margin-top: 5px;
  }

Although my classes are in my rendered HTML, there are not called and I don't know why....

Versions used:

Thx for any help !

Upvotes: 1

Views: 3308

Answers (1)

Vitalie Braga
Vitalie Braga

Reputation: 476

Here is a codepen that looks like it's working.

    <Dialog
      firstFocusableSelector="searchbox"
      hidden={hideDialog}
      onDismiss={this._closeDialog}
      dialogContentProps={{
        type: DialogType.normal,
        title: 'My Dialog',
        className: 'dialogadd'
      }}
      modalProps={{
        isBlocking: false
      }}
    >
      <div className='permcheck'>
        <Checkbox label="Test 1" />
        <Checkbox label="Test 2" />
        <Checkbox label="Test 3" />
      </div>
    </Dialog>

...and the scss I used for it is this:

.dialogadd {
  font-size: 20px;

  .permcheck {
    margin-top: 100px;
  }
}

Upvotes: 1

Related Questions