semantic-ui-react#StrictTextAreaProps TypeScript Examples

The following examples show how to use semantic-ui-react#StrictTextAreaProps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx    From frontegg-react with MIT License 6 votes vote down vote up
mapper = (props: InputProps): StrictInputProps | StrictFormInputProps | StrictTextAreaProps => {
  const { inForm, fullWidth, className, prefixIcon, suffixIcon, multiline, ...rest } = props;
  const data = {
    ...rest,
    className: classNames('fe-semantic-input', className, { fluid: multiline && fullWidth }),
  } as any;

  if (!multiline) {
    data.fluid = fullWidth;
  }

  if (prefixIcon) {
    data.iconPosition = 'left';
    data.actionPosition = 'left';
  }
  return data;
}
Example #2
Source File: index.tsx    From frontegg-react with MIT License 5 votes vote down vote up
Input = forwardRef<HTMLInputElement, InputProps>(
  ({ children, labelButton, multiline, label, ...restProps }, forwardRef) => {
    const inputLabel = useMemo(
      () =>
        labelButton ? (
          <label className='fe-label__with-button'>
            {label}
            <Button {...labelButton} />
          </label>
        ) : (
          label
        ),
      [labelButton, label]
    );

    const iconContent = useMemo(() => restProps.prefixIcon ?? restProps.suffixIcon, [restProps]);

    const inputProps = { ...mapper(restProps), label: inputLabel };

    return multiline ? (
      <Form.TextArea {...(inputProps as StrictTextAreaProps)} ref={forwardRef}></Form.TextArea>
    ) : restProps.iconAction ? (
      <Form.Input
        {...(inputProps as StrictInputProps | StrictFormInputProps)}
        icon
        action={{
          icon: iconContent,
          onClick: restProps.iconAction,
        }}
        ref={forwardRef}
      >
        {children}
      </Form.Input>
    ) : (
      <Form.Input {...(inputProps as StrictInputProps | StrictFormInputProps)} icon>
        <input ref={forwardRef} />
        {iconContent}
        {children}
      </Form.Input>
    );
  }
)