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

190
Visualizações
How to make responsive an input field with bootstrap or css?
import axios from "axios";

import React from "react";

import { useAuthState } from "react-firebase-hooks/auth";

import { useForm } from "react-hook-form";

import { toast, ToastContainer } from "react-toastify";

import auth from "../../firebase.init";

const AddInventoryItems = () => {

  const { register, handleSubmit } = useForm();

  const [user] = useAuthState(auth);

  const onSubmit = (data) => {
    axios.post("http://localhost:5000/item", data).then((res) => {

      const { data } = res;

      if (data) {

        toast("You have added a new item, Yeah!!!");

      }
    });
  };


  return (

    <div className="row w-25 mx-auto">

      <form

        className="d-flex flex-column my-5 col-sm-12 col-md-6"

        onSubmit={handleSubmit(onSubmit)}
      >
        <input
          placeholder="Enter Name"

          className="mb-2"

          value={user.displayName}

          type="text"

          {...register("user name")}

          required
        />
        <input

          placeholder="Enter Email"

          className="mb-2"

          type="email"

          value={user.email}

          {...register("email")}

        />
        <input

          placeholder="Image Url"

          className="mb-2"
          type="text"
          {...register("image")}
        />
        <input
          placeholder="Item name"
          className="mb-2"
          {...register("name", { required: true, maxLength: 20 })}
        />
        <input
          placeholder="Item description"
          className="mb-2"
          {...register("description")}
        />
        <input
          placeholder="Item price"
          className="mb-2"
          type="number"
          {...register("price", { min: 18, max: 99 })}
        />
        <input
          placeholder="Item quantity"
          className="mb-2"
          type="number"
          {...register("quantity", { min: 18, max: 99 })}
        />
        <input
          placeholder="Supplier name"
          className="mb-2"
          {...register("supplier name")}
        />
        <input
          className="btn btn-outline-primary"
          type="submit"
          value="Add new item"
        />
      </form>
      <ToastContainer />
    </div>
  );
};

export default AddInventoryItems;
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

To make responsive form elements, you have to wrap all the inputs in form-group class and in their inputs you have to add class form-control

example:

<div class="form-group">
  <label for=""></label>
  <input type="email" class="form-control" />
</div>

take a look on Bootstrap documentation:

https://getbootstrap.com/docs/5.1/forms/overview/

about 4 years ago · Juan Pablo Isaza Relatório

0

Use form-control class in your form input field. So your form field will be responsive.

  <form className="d-flex flex-column my-5 col-sm-12 col-md-6 form-control" onSubmit={handleSubmit(onSubmit)}>

You can also see bootstrap official documentation for more detail

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