Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add leading icon and trailing button support to <Input/> #2818

Closed
sebald opened this issue Feb 24, 2023 · 0 comments · Fixed by #2824
Closed

Add leading icon and trailing button support to <Input/> #2818

sebald opened this issue Feb 24, 2023 · 0 comments · Fixed by #2824
Assignees
Labels
status:rfc New issue that requires discussion and finalization type:feature New feature or component

Comments

@sebald
Copy link
Member

sebald commented Feb 24, 2023

Description

It should be possible to add an icon to an input field to support its usage. This is especially helpful for search field, for example. The leading icon should only be a visual aid and has not functionality besides clicking of it should also focus the input.

For more complex fields, like a date picker input fields need to have the option to display a trailing icon (button). The trailing icon button is interaction and will have user interaction.

This is an image from Material Design to visualize the anatomy of an input with leading and trailing icons:

image

Proposal

We could either extend the existing <Input/> with additional props, or we could create a dedicated component that is composable.

<Input
  leading={<SearchIcon />}
  trailing={
    <Button>
      <XIcon />
    </Button>
  }
/>
<InputContainer>
  <SearchIcon />
  <Input variant="clear" />
  <Button>
    <XIcon />
  </Button>
</InputContainer>
@sebald sebald added type:feature New feature or component status:rfc New issue that requires discussion and finalization labels Feb 24, 2023
@sarahgm sarahgm self-assigned this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:rfc New issue that requires discussion and finalization type:feature New feature or component
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants