Search code examples
reactjsmaterial-uistyles

How to append a button to TextField in Material UI


How can I append a button to a TextField like in bootstrap input group? Bootstrap button append

I tried this, but it is too ugly:

<TextField fullWidth
            variant="outlined"
            label="Add Something"
            InputProps={
                {
                    endAdornment: (
                        <InputAdornment position="end">
                            <Button
                                aria-label="Add"
                                edge="end"
                                color="primary"
                                variant="contained"
                            >
                                ADD
                            </Button>
                        </InputAdornment>
                    )
                }
            }
/>

Solution

  • <FormGroup row>
      <TextField variant="outlined" placeholder="username" />
      <Button variant="contained" disableElevation>
        @example.com
      </Button>
    </FormGroup>
    

    Edit pedantic-pasteur-x8d7b