Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda