Topic: Can I use only input and select components?

cantarderanas free asked 3 years ago


Hello, I want to know if it's possible to only use select and date picker components without importing the entire mdb css? And how would that work? Thank you


Arkadiusz Idzikowski staff answered 3 years ago


It's possible, but you would need to import all the required parts of the styles for these components. To do it properly, we recommend to copy them from the node_modules/mdb-ui-kit/src/scss location directly to your project and import in the same way as CSS files. You can use our starter project to speed up the process: https://github.com/mdbootstrap/mdb-webpack-starter

Here is an example. In the index.scss file, comment out the mdb.min.css and import the scss parts:

// @import '~mdb-ui-kit/css/mdb.min.css';

@import '~mdb-ui-kit/src/scss/mdb.core.scss';
@import '~mdb-ui-kit/src/scss/bootstrap/forms';
@import '~mdb-ui-kit/src/scss/free/forms/form-control.scss';
@import '~mdb-ui-kit/src/scss/free/forms/form-select.scss';
@import '~mdb-ui-kit/src/scss/free/forms/form-check.scss';
@import '~mdb-ui-kit/src/scss/pro/variables.scss';
@import '~mdb-ui-kit/src/scss/pro/datepicker';
@import '~mdb-ui-kit/src/scss/pro/select.scss';

The same rule applies to the javascript files. You can import just individual modules:

import { Input } from 'mdb-ui-kit';
import { Select } from 'mdb-ui-kit';
import { Datepicker } from 'mdb-ui-kit';


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 2.0.0
  • Device: Web
  • Browser: Chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No