Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Form Field description prop should accept a React component #365

Closed
nkohari opened this issue Mar 5, 2018 · 1 comment
Closed

Form Field description prop should accept a React component #365

nkohari opened this issue Mar 5, 2018 · 1 comment
Assignees
Milestone

Comments

@nkohari
Copy link
Contributor

nkohari commented Mar 5, 2018

On Form Fields, the description prop (which shows the "helper text" beneath the field) must be a string. For example:

const MyComponent = props => (
  <Form>
    <Form.TextInput label="Form label" description="test" />
  </Form>
);

Instead, we should expand this to also allow a React component to be passed. For example:

const MyComponent = props => {
  const description = <Paragraph>Here is some <strong>rich-formatted</strong> helper text.</Paragraph>;
  return (
    <Form>
      <Form.TextInput label="Form label" description={description} />
    </Form>
  );
};

If the description value is a string, it should just be rendered as plain text.

@nkohari nkohari added this to To do in Cosmos 0.1.0 via automation Mar 5, 2018
@nkohari nkohari added this to the Cosmos 0.1 milestone Mar 6, 2018
@nkohari nkohari self-assigned this Mar 7, 2018
@nkohari nkohari moved this from Backlog to In Progress in Cosmos 0.1.0 Mar 7, 2018
@nkohari
Copy link
Contributor Author

nkohari commented Mar 7, 2018

Right now, if the user supplies a string, we're doing replacement of backticks with <Code> components, similar to Markdown. Do we want to keep this behavior?

On one hand it might be nice to provide a simple shortcut, but I worry that having two alternatives might be a bit confusing.

@nkohari nkohari moved this from In Progress to Needs Review in Cosmos 0.1.0 Mar 8, 2018
Cosmos 0.1.0 automation moved this from Needs Review to Done Mar 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Cosmos 0.1.0
  
Done
Development

No branches or pull requests

1 participant