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

To help you get started, we’ve selected a few @react-md/form 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 / documentation / components / Demos / Form / TextFieldThemeConfig.tsx View on Github external
const TextFieldThemeConfig: FC = ({
  idPrefix,
  children,
  renderField,
  disableDense,
  disableRightIcon,
}) => {
  const [useLeft, handleLeftChange, setLeftIcon] = useCheckboxState(false);
  const [useRight, handleRightChange, setRightIcon] = useCheckboxState(false);
  const [dense, handleDenseChange, setDense] = useCheckboxState(false);
  const [label, handleLabelChange, setLabel] = useCheckboxState(true);
  const [inline, handleInlineChange] = useCheckboxState(false);
  const [readOnly, handleReadOnlyChange, setReadOnly] = useCheckboxState(false);
  const [error, handleErrorChange, setError] = useCheckboxState(false);
  const [disabled, handleDisabledChange] = useCheckboxState(false);
  const [currentTheme, handleThemeChange] = useChoice(
    "outline",
    event => {
      // the "unstyled" state does not support icons and a label out of the box
      // and requires additional styling instead
      if (event.currentTarget.value === "none") {
        setLeftIcon(false);
        setRightIcon(false);
        setLabel(false);
      } else if (!label) {
        setLabel(true);
      }
    }
  );
  const isUnstyled = currentTheme === "none";
  if (disabled && error) {
    setError(false);
github mlaursen / react-md / packages / documentation / src / components / Demos / Form / TextFieldThemeConfig.tsx View on Github external
const TextFieldThemeConfig: FC = ({
  idPrefix,
  children,
  renderField,
  disableDense,
  disableRightIcon,
}) => {
  const [useLeft, handleLeftChange, setLeftIcon] = useCheckboxState(false);
  const [useRight, handleRightChange, setRightIcon] = useCheckboxState(false);
  const [dense, handleDenseChange, setDense] = useCheckboxState(false);
  const [label, handleLabelChange, setLabel] = useCheckboxState(true);
  const [inline, handleInlineChange] = useCheckboxState(false);
  const [readOnly, handleReadOnlyChange, setReadOnly] = useCheckboxState(false);
  const [error, handleErrorChange, setError] = useCheckboxState(false);
  const [disabled, handleDisabledChange] = useCheckboxState(false);
  const [currentTheme, handleThemeChange] = useChoice(
    "outline",
    event => {
      // the "unstyled" state does not support icons and a label out of the box
      // and requires additional styling instead
      if (event.currentTarget.value === "none") {
        setLeftIcon(false);
        setRightIcon(false);
        setLabel(false);
      } else if (!label) {
        setLabel(true);
      }
github mlaursen / react-md / packages / documentation / src / components / Demos / Form / TextFieldThemeConfig.tsx View on Github external
const TextFieldThemeConfig: FC = ({
  idPrefix,
  children,
  renderField,
  disableDense,
  disableRightIcon,
}) => {
  const [useLeft, handleLeftChange, setLeftIcon] = useCheckboxState(false);
  const [useRight, handleRightChange, setRightIcon] = useCheckboxState(false);
  const [dense, handleDenseChange, setDense] = useCheckboxState(false);
  const [label, handleLabelChange, setLabel] = useCheckboxState(true);
  const [inline, handleInlineChange] = useCheckboxState(false);
  const [readOnly, handleReadOnlyChange, setReadOnly] = useCheckboxState(false);
  const [error, handleErrorChange, setError] = useCheckboxState(false);
  const [disabled, handleDisabledChange] = useCheckboxState(false);
  const [currentTheme, handleThemeChange] = useChoice(
    "outline",
    event => {
      // the "unstyled" state does not support icons and a label out of the box
      // and requires additional styling instead
      if (event.currentTarget.value === "none") {
        setLeftIcon(false);
        setRightIcon(false);
        setLabel(false);
      } else if (!label) {
        setLabel(true);
      }
    }
github mlaursen / react-md / packages / autocomplete / src / AutoComplete.tsx View on Github external
{filteredData.map((datum, i) => {
            const resultId = getResultId(suggestionsId, i);
            let optionProps: ListboxOptionProps | undefined;
            if (isListboxOptionProps(datum)) {
              optionProps = omit(datum, [labelKey, valueKey]);
            }

            return (
              <option selected="{false}" id="{resultId}"> handleAutoComplete(i)}
              &gt;
                
                  {getResultLabel(datum, labelKey, value)}
                </option>
github mlaursen / react-md / packages / documentation / src / components / Demos / Form / TextFieldTypes.tsx View on Github external
const TextFieldTypes: FC = () =&gt; {
  const [currentTheme, handleThemeChange] = useChoice(
    "outline"
  );

  return (
    <form>
      <fieldset>
        {themes.map(theme =&gt; (
          </fieldset></form>
github mlaursen / react-md / packages / documentation / components / Demos / Form / TextAreaExample.tsx View on Github external
const TextAreaExample: FC = () =&gt; {
  const [resize, handleResizeChange] = useChoice("auto");
  const [animate, handleAnimateChange] = useCheckboxState(true);
  const [rows, handleRowChange] = useChoice("2");
  const [maxRows, handleMaxRowChange, setMaxRows] = useChoice("-1");
  const rowsInt = parseInt(rows, 10);
  const maxRowsInt = parseInt(maxRows, 10);
  if (maxRowsInt !== -1 &amp;&amp; maxRowsInt &lt; rowsInt) {
    const i = MAX_ROWS.find(value =&gt; value &gt;= rowsInt) || -1;
    setMaxRows(`${i}`);
  }

  return (
     (
github mlaursen / react-md / packages / documentation / src / components / Demos / Form / TextAreaExample.tsx View on Github external
const TextAreaExample: FC = () =&gt; {
  const [resize, handleResizeChange] = useChoice("auto");
  const [animate, handleAnimateChange] = useCheckboxState(true);
  const [rows, handleRowChange] = useChoice("2");
  const [maxRows, handleMaxRowChange, setMaxRows] = useChoice("-1");
  const rowsInt = parseInt(rows, 10);
  const maxRowsInt = parseInt(maxRows, 10);
  if (maxRowsInt !== -1 &amp;&amp; maxRowsInt &lt; rowsInt) {
    const i = MAX_ROWS.find(value =&gt; value &gt;= rowsInt) || -1;
    setMaxRows(`${i}`);
  }

  return (
     (
github mlaursen / react-md / packages / documentation / src / components / Demos / Form / NativeSelectExample.tsx View on Github external
const NativeSelectExample: FC = () =&gt; {
  const [icon, handleIconChange, setIcon] = useCheckboxState(true);
  const [size, handleSizeChange] = useChoice("4");
  const [multiple, handleMultipleChange] = useCheckboxState(false);
  const [optgroup, handleOptgroupChange] = useCheckboxState(false);
  if (multiple &amp;&amp; icon) {
    setIcon(false);
  }

  return (
github mlaursen / react-md / packages / documentation / src / components / Demos / Alert / HandlingDuplicatedMessages.tsx View on Github external
const HandlingDuplicatedMessages: FC = ({
  duplicates,
  onDuplicateChange,
}) =&gt; {
  const addMessage = useAddMessage();
  const [key, handleKeyChange] = useChoice(ONLINE);
  return (
    <form> addMessage(MESSAGES[key])}&gt;
      <fieldset>
            <code>MessageQueue</code>
            {" duplicate behavior"}
          
        }
      &gt;
        </fieldset></form>
github mlaursen / react-md / packages / documentation / components / Demos / Alert / UpdatingMessagePriority.tsx View on Github external
const UpdatingMessagePriority: FC = () =&gt; {
  const addMessage = useAddMessage();
  const [priority, handlePriorityChange] = useChoice("next");
  const queue = useQueue();
  const [running, setRunning] = useState(false);

  if (running &amp;&amp; !queue.length) {
    setRunning(false);
  }

  const exampleNextFlow = useCallback(() =&gt; {
    addMessage({
      messageId: "message-1",
      children: "First normal message",
      messagePriority: "normal",
    });
    addMessage({
      messageId: "message-2",
      children: "Second normal message",

@react-md/form

This package is for creating all the different form input types.

MIT
Latest version published 4 months ago

Package Health Score

70 / 100
Full package analysis