How to use @material-ui/lab - 10 common examples

To help you get started, we’ve selected a few @material-ui/lab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mui-org / material-ui / docs / src / pages / components / autocomplete / Filter.tsx View on Github external
/* eslint-disable no-use-before-define */
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Autocomplete, { createFilterOptions } from '@material-ui/lab/Autocomplete';

const filterOptions = createFilterOptions({
  matchFrom: 'start',
  stringify: (option: FilmOptionType) => option.title,
});

export default function Filter() {
  return (
     option.title}
      filterOptions={filterOptions}
      style={{ width: 300 }}
      renderInput={params => (
        
      )}
    />
github mui-org / material-ui / docs / src / pages / components / autocomplete / Filter.js View on Github external
/* eslint-disable no-use-before-define */
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Autocomplete, { createFilterOptions } from '@material-ui/lab/Autocomplete';

const filterOptions = createFilterOptions({
  matchFrom: 'start',
  stringify: option => option.title,
});

export default function Filter() {
  return (
     option.title}
      filterOptions={filterOptions}
      style={{ width: 300 }}
      renderInput={params => (
        
      )}
    />
github BlueBrain / Brayns / js / apps / viewer / src / common / components / fields / numeric-field.tsx View on Github external
import {isNumber, isString} from 'lodash';

import {PropTypes} from '@material-ui/core';
import {
    createStyles,
    Theme,
    withStyles,
    WithStyles
} from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import Typography from '@material-ui/core/Typography';


// TODO: Import properly after https://github.com/mui-org/material-ui/issues/11736 is fixed
// tslint:disable-next-line: no-var-requires
const Slider = require('@material-ui/lab/Slider').default;


const styles = (theme: Theme) => createStyles({
    root: {
        display: 'inline-flex',
        flexDirection: 'column',
        minWidth: 0
    },
    slider: {
        // TODO: Remove when https://github.com/mui-org/material-ui/issues/13455 is fixed
        padding: 24,
        margin: -24,
        overflow: 'hidden',
        boxSizing: 'content-box'
    },
    marginNormal: {
github mui-org / material-ui / docs / src / pages / components / autocomplete / UseAutocomplete.tsx View on Github external
export default function UseAutocomplete() {
  const classes = useStyles();
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
  } = useAutocomplete({
    id: 'use-autocomplete-demo',
    options: top100Films,
    getOptionLabel: option => option.title,
  });

  return (
    <div>
      <div>
        <label>
          useAutocomplete
        </label>
        <input>
      </div>
      {groupedOptions.length &gt; 0 ? (
        <ul>
          {groupedOptions.map((option, index) =&gt; (</ul></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / CustomizedHook.tsx View on Github external
export default function CustomizedHook() {
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getTagProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
    value,
    focused,
    setAnchorEl,
  } = useAutocomplete({
    id: 'customized-hook-demo',
    defaultValue: [top100Films[1]],
    multiple: true,
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>Customized hook</label>
        
          {value.map((option: FilmOptionType, index: number) =&gt; (
            
          ))}
          <input></div></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / UseAutocomplete.js View on Github external
export default function UseAutocomplete() {
  const classes = useStyles();
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
  } = useAutocomplete({
    id: 'use-autocomplete-demo',
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>
          useAutocomplete
        </label>
        <input>
      </div>
      {groupedOptions.length &gt; 0 ? (
        <ul>
          {groupedOptions.map((option, index) =&gt; (</ul></div>
github mui-org / material-ui / docs / src / pages / components / autocomplete / CustomizedHook.js View on Github external
export default function CustomizedHook() {
  const {
    getRootProps,
    getInputLabelProps,
    getInputProps,
    getTagProps,
    getListboxProps,
    getOptionProps,
    groupedOptions,
    value,
    focused,
    setAnchorEl,
  } = useAutocomplete({
    id: 'customized-hook-demo',
    defaultValue: [top100Films[1]],
    multiple: true,
    options: top100Films,
    getOptionLabel: option =&gt; option.title,
  });

  return (
    <div>
      <div>
        <label>Customized hook</label>
        
          {value.map((option, index) =&gt; (
            
          ))}
</div></div>
github navidrome / navidrome / ui / src / dialogs / SelectPlaylistInput.js View on Github external
import React from 'react'
import TextField from '@material-ui/core/TextField'
import Checkbox from '@material-ui/core/Checkbox'
import CheckBoxIcon from '@material-ui/icons/CheckBox'
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'
import Autocomplete, {
  createFilterOptions,
} from '@material-ui/lab/Autocomplete'
import { useGetList, useTranslate } from 'react-admin'
import PropTypes from 'prop-types'
import { isWritable } from '../common'
import { makeStyles } from '@material-ui/core'

const filter = createFilterOptions()

const useStyles = makeStyles({
  root: { width: '100%' },
  checkbox: { marginRight: 8 },
})

export const SelectPlaylistInput = ({ onChange }) => {
  const classes = useStyles()
  const translate = useTranslate()
  const { ids, data } = useGetList(
    'playlist',
    { page: 1, perPage: -1 },
    { field: 'name', order: 'ASC' },
    {}
  )
github openequella / openEQUELLA / Source / Plugins / Core / com.equella.core / js / src / ExtUI / SpeedDial.js View on Github external
exports.speedDialClass = require('@material-ui/lab/SpeedDial').default;
exports.speedDialIconClass = require('@material-ui/lab/SpeedDialIcon').default;
exports.speedDialActionClass = require('@material-ui/lab/SpeedDialAction').default;
github openequella / openEQUELLA / Source / Plugins / Core / com.equella.core / js / src / ExtUI / SpeedDial.js View on Github external
exports.speedDialClass = require('@material-ui/lab/SpeedDial').default;
exports.speedDialIconClass = require('@material-ui/lab/SpeedDialIcon').default;
exports.speedDialActionClass = require('@material-ui/lab/SpeedDialAction').default;