How to use @instructure/ui-options - 3 common examples

To help you get started, we’ve selected a few @instructure/ui-options 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 instructure / instructure-ui / packages / ui-select / src / Select / index.js View on Github external
const { getOptionProps, getDisabledOptionProps } = data
    const {
      id,
      isDisabled,
      isHighlighted,
      isSelected,
      renderBeforeLabel,
      renderAfterLabel,
      children
    } = option.props

    let optionProps = {
      // passthrough props
      ...omitProps(option.props, {
        ...Option.propTypes,
        ...Options.Item.propTypes
      }),
      // props from selectable
      ...getOptionProps({ id }),
      // Options.Item props
      renderBeforeLabel,
      renderAfterLabel
    }
    // should option be treated as highlighted or selected
    if (isSelected) {
      optionProps.variant = 'selected'
    } else if (isHighlighted) {
      optionProps.variant = 'highlighted'
    }
    // should option be treated as disabled
    if (isDisabled) {
      optionProps.variant = 'disabled'
github instructure / instructure-ui / packages / ui-select / src / Select / index.js View on Github external
const groupChildren = []
    // add a separator above
    if (!isFirstChild && !afterGroup) {
      groupChildren.push()
    }
    // create a sublist as a group
    // a wrapping listitem will be created by Options
    groupChildren.push(
      
        {Children.map(children, (child) => {
          return this.renderOption(child, {
            getOptionProps,
            getDisabledOptionProps
          })
        })}
      
    )
    // add a separator below
    if (!isLastChild) {
      groupChildren.push()
    }
github instructure / instructure-ui / packages / ui-select / src / Select / locator.js View on Github external
findOptionsList: async (element, ...args) => {
    const content = await PopoverLocator.findContent(element, ...args)
    return content ? OptionsLocator.find(content.getDOMNode()) : null
  }
})

@instructure/ui-options

A view-only component for composing interactive lists and menus.

MIT
Latest version published 2 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages