Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
Make the input and button on the same line

I'm making a todo list app using react and chakra ui.

I want to make the input and the button on the same line.

This is what i get: photo

I want to make something like this: photo

My Code:

App.js:

import "./App.css";
import { ChakraProvider } from "@chakra-ui/react";
import Todo from "./components/Todo";

function App() {
  return (
    <ChakraProvider>
      <div className="App">
        <Todo />
      </div>
    </ChakraProvider>
  );
}

export default App;

Todo.js:

import { Container, Box, Heading, Input, Button } from "@chakra-ui/react";
import { MdAdd } from "react-icons/md";

function Todo() {
  return (
    <Container
      maxW="4xl"
      minHeight="100vh"
      display="flex"
      alignItems="center"
      justifyContent="center"
    >
      <Box
        boxShadow="base"
        rounded="lg"
        padding={10}
        background="white"
        width="100%"
      >
        <Heading as="h1" size="md" textAlign="center">
          Todo List App
        </Heading>
        <Box display="flex" alignItems="center" justifyContent="space-between">
          <Input placeholder="New Task" marginTop={5} size="lg" />
          <Button colorScheme="blue" rightIcon={<MdAdd />} margin={0}>
            Add
          </Button>
        </Box>
      </Box>
    </Container>
  );
}

export default Todo;
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

removing the margin top from input should fix it:

                                    Here
                                     ||

 <Input placeholder="New Task" marginTop={5} size="lg" />
about 4 years ago · Juan Pablo Isaza Relatório

0

you are giving the input a margin-top, you can delete the margin or give the input and the button the same margin.

about 4 years ago · Juan Pablo Isaza Relatório

0

input and button on same line is not possible,You can try this fire a ngModel event on input and get the data entered in input.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda