How to use @react-md/icon - 10 common examples

To help you get started, we’ve selected a few @react-md/icon 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 mlaursen / react-md / packages / tree / src / Tree.tsx View on Github external
expanderIcon: propExpanderIcon,
    labelKey: _labelKey,
    valueKey,
    getItemLabel: _getItemLabel,
    getItemValue,
    getItemProps: _getItemProps,
    linkComponent: _linkComponent,
    sort,
    rootId,
    onBlur,
    onFocus,
    onKeyDown,
    ...props
  } = providedProps as WithDefaultProps;
  const { id } = props;
  const expanderIcon = useIcon("dropdown", propExpanderIcon);

  const {
    items,
    activeId,
    setActiveId,
    itemIdRefs,
    handleBlur,
    handleFocus,
    handleKeyDown,
  } = useTreeMovement({
    id,
    data,
    sort,
    rootId,
    onBlur,
    onFocus,
github mlaursen / react-md / packages / tree / src / TreeItem.tsx View on Github external
leftIcon: propLeftIcon,
    leftAvatar,
    rightIcon: propRightIcon,
    rightAvatar,
    forceIconWrap,
    height,
    threeLines,
    children,
    contentComponent: Content,
    isLink: propIsLink,
    disabled,
    readOnly,
    onFocus,
    ...props
  } = providedProps as WithDefaultProps;
  const expanderIcon = useIcon("expander", propExpanderIcon);

  const isLink =
    typeof propIsLink === "boolean"
      ? propIsLink
      : typeof Content !== "string" || Content === "a";

  const { ripples, className, handlers } = useInteractionStates({
    disabled,
    className: propClassName,
    handlers: isLink ? props : undefined,
    disableSpacebarClick: isLink,
  });

  let group;
  let leftIcon = propLeftIcon;
  let rightIcon = propRightIcon;
github mlaursen / react-md / packages / form / src / select / Select.tsx View on Github external
getOptionValue,
    getDisplayLabel,
    isOptionDisabled,
    disableLeftAddon,
    disableMovementChange,
    disableHideOnResize,
    disableHideOnScroll,
    readOnly,
    placeholder,
    value,
    onChange,
    rightChildren: propRightChildren,
    ...props
  } = providedProps as WithDefaultProps;
  const { id, disabled, error, dense } = props;
  const rightChildren = useIcon("dropdown", propRightChildren);

  const valued = typeof value === "number" || !!value;
  const displayValue = useMemo(() => {
    const currentOption =
      options.find(option => getOptionValue(option, valueKey) === value) ||
      null;

    return getDisplayLabel(currentOption, labelKey, !disableLeftAddon);
  }, [
    options,
    getDisplayLabel,
    labelKey,
    disableLeftAddon,
    getOptionValue,
    valueKey,
    value,
github mlaursen / react-md / packages / layout / src / LayoutNavigation.tsx View on Github external
hideNavLabelledBy,
  sheetLabel,
  sheetLabelledBy,
  sheetStyle,
  sheetClassName,
  navHeader: propNavHeader,
  navHeaderTitle,
  navHeaderStyle,
  navHeaderClassName,
  navFooter,
  disableTemporaryAutoclose,
  ...props
}) => {
  const { selectedIds } = props;
  useTemporaryNavigation(selectedIds, disableTemporaryAutoclose);
  const hideNavIcon = useIcon("back", propHideNavIcon);
  const {
    hideNav,
    layout,
    isFullHeight,
    isPersistent,
    isNavVisible,
  } = useNavigationVisibility();
  const tree = (
    
  );
github mlaursen / react-md / packages / form / src / toggle / Checkbox.tsx View on Github external
const Checkbox: FC> = ({
  forwardedRef,
  icon: propIcon,
  ...props
}) => {
  const icon = useIcon("checkbox", propIcon);

  return (
    
  );
};
github mlaursen / react-md / packages / form / src / text-field / Password.tsx View on Github external
inputClassName,
    forwardedRef,
    visibilityIcon: propVisibilityIcon,
    disableVisibility,
    visibilityStyle,
    visibilityClassName,
    visibilityLabel,
    ...props
  } = providedProps as WithDefaultProps;
  const { id } = props;
  const [type, setType] = useState<"password" | "text">("password");
  const toggle = useCallback(() => {
    setType(prevType => (prevType === "password" ? "text" : "password"));
  }, []);

  const visibilityIcon = useIcon("password", propVisibilityIcon);

  return (
github mlaursen / react-md / packages / tree / src / TreeItemExpanderIcon.tsx View on Github external
const TreeItemExpanderIcon: FC = providedProps => {
  const { className, children, ...props } = providedProps as WithDefaultProps;
  const icon = useIcon("expander", children);

  return (
    
      {icon}
    
  );
};
github mlaursen / react-md / packages / form / src / file-input / FileInput.tsx View on Github external
disableIconSpacing,
    disableRepeatableFiles,
    onKeyDown,
    onKeyUp,
    onMouseDown,
    onMouseUp,
    onMouseLeave,
    onClick,
    onTouchStart,
    onTouchMove,
    onTouchEnd,
    onChange,
    ...props
  } = providedProps as WithDefaultProps;
  const { id, disabled } = props;
  const icon = useIcon("download", propIcon);

  const { ripples, className, handlers } = useInteractionStates({
    handlers: {
      onKeyDown,
      onKeyUp,
      onMouseDown,
      onMouseUp,
      onMouseLeave,
      onClick,
      onTouchStart,
      onTouchMove,
      onTouchEnd,
    },
    className: buttonThemeClassNames({
      theme,
      themeType,
github mlaursen / react-md / packages / menu / src / MenuButton.tsx View on Github external
const MenuButton: FC = ({
  className,
  visible,
  children,
  forwardedRef,
  dropdownIcon: propDropdownIcon,
  disableDropdownIcon,
  first,
  last,
  inheritColor,
  asAppBarAction,
  ...props
}) => {
  const { buttonType } = props;
  const dropdownIcon = useIcon("dropdown", propDropdownIcon);
  const actionClassName = useActionClassName({ first, last, inheritColor });
  return (
    <button aria-expanded="{visible">
      </button>
github mlaursen / react-md / packages / badge / src / BadgedButton.tsx View on Github external
const BadgedButton: FC = providedProps =&gt; {
  const {
    badgeStyle,
    badgeClassName,
    badgeRef,
    badgeId: propBadgeId,
    buttonChildren: propButtonChildren,
    badgeTheme,
    forwardedRef,
    children,
    disableNullOnZero,
    "aria-describedby": propDescribedBy,
    ...props
  } = providedProps as WithDefaultProps;
  const { id } = props;
  const buttonChildren = useIcon("notification", propButtonChildren);

  let badgeId = propBadgeId || "";
  if (!badgeId &amp;&amp; id) {
    badgeId = `${id}-badge`;
  }

  let describedBy = propDescribedBy;
  if (!isEmpty(children, disableNullOnZero)) {
    describedBy = cn(describedBy, badgeId);
  }

  return (
    <button aria-describedby="{describedBy}">
      {buttonChildren}
      </button>

@react-md/icon

This package is for including icons within react-md. There is included support for both font icons and SVG icons. There is also a helper component for applying spacing between icons and text.

MIT
Latest version published 11 months ago

Package Health Score

69 / 100
Full package analysis

Popular @react-md/icon functions