How to use @modulz/radix-system - 7 common examples

To help you get started, we’ve selected a few @modulz/radix-system 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 modulz / radix / packages / radix / src / components / CheckboxButton.tsx View on Github external
import React from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';

export type CheckboxButtonProps = MarginProps &
  React.ComponentPropsWithRef<'input'> & { children: React.ReactNode };

const marginPropNames = margin.propNames;

export const CheckboxButton = React.forwardRef(
  ({ children, ...props }, forwardedRef) => {
    const marginProps = pick(props, marginPropNames);
    const inputProps = omit(props, marginPropNames);

    return (
      
        <input type="checkbox">
        {children}
      
    );
  }
);

const CheckboxWrapper = styled('label')(
github modulz / radix / packages / radix / src / components / Switch.tsx View on Github external
import React, { FC, ComponentProps } from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';
import themeGet from '@styled-system/theme-get';

export type SwitchProps = MarginProps &amp; ComponentProps&lt;'input'&gt;;

const marginPropNames = margin.propNames;

export const Switch: FC = ({ children, ...props }) =&gt; {
  const marginProps = pick(props, marginPropNames);
  const inputProps = omit(props, marginPropNames);

  return (
    
      <input type="checkbox">
      
    
  );
};

const SwitchWrapper = styled('label')(
  css({
    position: 'relative',
github modulz / radix / packages / radix / src / components / RadioGroup.tsx View on Github external
const isControlled = Boolean(value);

  return (
    <div>
      {React.Children.map(children, (radio: ReactElement) =&gt;
        React.cloneElement(radio, {
          name,
          onChange,
          ...(isControlled ? { checked: value === radio.props.value } : {}),
        })
      )}
    </div>
  );
};

const marginPropNames = margin.propNames;

type Ref = HTMLInputElement;
export type RadioProps = MarginProps &amp; ComponentPropsWithRef&lt;'input'&gt;;

export const Radio: FC = forwardRef((props, forwardedRef) =&gt; {
  const { children, ...otherProps } = props;
  const systemProps = pick(otherProps, marginPropNames);
  const inputProps = omit(otherProps, marginPropNames);

  return (
    
      <input type="radio">
      
      {children &amp;&amp; {children}}
    
  );
github modulz / radix / packages / radix / src / components / Checkbox.tsx View on Github external
import React, { ComponentProps } from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';

export type CheckboxProps = MarginProps &amp; ComponentProps&lt;'input'&gt;;

const marginPropNames = margin.propNames;

export const Checkbox = React.forwardRef(
  ({ children, ...props }, forwaredRef) =&gt; {
    const marginProps = pick(props, marginPropNames);
    const inputProps = omit(props, marginPropNames);

    return (
      
        <input type="checkbox">
        
github modulz / radix / packages / radix / src / components / Box.tsx View on Github external
JustifySelfProps &amp;
  MarginProps &amp;
  MaxWidthProps &amp;
  MaxHeightProps &amp;
  MinHeightProps &amp;
  MinWidthProps &amp;
  OpacityProps &amp;
  OverflowProps &amp;
  PaddingProps &amp;
  TextAlignProps &amp;
  WidthProps &amp;
  PositionSetProps &amp;
  FlexItemSetProps &amp;
  ComponentProps&lt;'div'&gt; &amp; { as?: any };

const styleProps = compose(
  border,
  boxShadow,
  backgroundColor,
  textColor,
  display,
  height,
  justifySelf,
  margin,
  maxHeight,
  maxWidth,
  minHeight,
  minWidth,
  opacity,
  overflow,
  padding,
  textAlign,
github modulz / radix / packages / radix / src / components / GhostButton.tsx View on Github external
import styled from 'styled-components';
import css from '@styled-system/css';
import { margin, MarginProps, padding, PaddingProps, variant, compose } from '@modulz/radix-system';
import themeGet from '@styled-system/theme-get';

type GhostButtonProps = MarginProps &amp;
  PaddingProps &amp; {
    isActive?: Boolean;
  };

const styleProps = compose(
  margin,
  padding
);

export const GhostButton = styled.button(
  props =&gt;
    css({
      appearance: 'none',
      backgroundColor: 'transparent',
      border: 'none',
      borderRadius: 9999,
      color: 'gray800',
      display: 'inline-flex',
      flexShrink: 0,
      alignItems: 'center',
      fontFamily: 'normal',
github modulz / radix / packages / radix / src / components / PillNav.tsx View on Github external
import React, { FC, ReactElement } from 'react';
import styled from 'styled-components';
import { MarginProps, system, Prop } from '@modulz/radix-system';
import themeGet from '@styled-system/theme-get';
import css from '@styled-system/css';
import * as CSS from 'csstype';
import { transparentize } from 'polished';
import { Box } from './Box';

const pillWidth = system({
  pillWidth: {
    property: 'width',
  },
});

interface PillWidthProps {
  pillWidth?: Prop&gt;;
}

export type PillNavProps = MarginProps &amp;
  PillWidthProps &amp; {
    children: ReactElement[];
  };

export const PillNav: FC = ({ children, pillWidth, ...props }) =&gt; {
  return (

@modulz/radix-system

Radix System Library

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages