Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

How to create a Order Form

 

     

 

  How to Create Order form using  html and CSS, JS


 👇 Create a  Order form with source code

Source Code 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="
width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible"
content="ie=edge">
  <title>Order Form</title>
 
  <link rel="stylesheet" href="style6.css">
<style>
  *{
  box-sizing: border-box;
}

body{
 
  color:#485e74;
  line-height:1.6;
  font-family: 'Segoe UI', Tahoma,
Geneva, Verdana, sans-serif;
  padding:1em;
}

.container{
  max-width:1170px;
  margin-left:auto;
  margin-right:auto;
  padding:1em;
}

ul{
  list-style: none;
  padding:0;
}

.brand{
  text-align: center;
}

.brand span{
  color:#fff;
}

.wrapper{
  box-shadow: 0 0 20px 0 rgba(72,94,116,0.7);
}

.wrapper > *{
  padding: 1em;
}

.company-info{
  background:#BC8F8F;
}

.company-info h3, .company-info ul{
  text-align: center;
  margin:0 0 1rem 0;
}

.contact{
  background:#99B1E7;
}

/* FORM STYLES */
.contact form{
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap:20px;
}

.contact form label{
  display:block;
}

.contact form p{
  margin:0;
}

.contact form .full{
  grid-column: 1 / 3;
}

.contact form button, .contact form input,
.contact form textarea{
  width:100%;
  padding:1em;
  border:1px solid #c9e6ff;
}

.contact form button{
  background:#F5DEB3;
  border:0;
  text-transform: uppercase;
}

.contact form button:hover,.contact form
button:focus{
  background:#92bde7;
  color:#fff;
  outline:0;
  transition: background-color 2s ease-out;
}

.alert{
  text-align: center;
  padding:10px;
  background:#99B1E7;
  color:#fff;
  margin-bottom:10px;
  display:none;
}

/* LARGE SCREENS */
@media(min-width:700px){
  .wrapper{
    display: grid;
    grid-template-columns: 1fr 2fr;
  }

  .wrapper > *{
    padding:2em;
  }

  .company-info h3, .company-info ul, .brand{
    text-align: left;
  }
}
  </style>
</head>
<body>
  <div class="container">
    <h1 class="brand"><span>Shree Saree shop
<span></h1>
    <div class="wrapper">
      <div class="company-info">
        <h3>company owner Name </h3>
        <ul>
          <li><i class="fa fa-road"></i>
xyz@gmail.com  <li>
<i class="fa fa-phone"></i> +91  776882903</li>
        </ul>
      </div>
      <div class="contact">
        <h3><center>Order Form</center></h3>
        <div class="alert">Your message has
been sent</div>
        <form id="contactForm">
          <p>
            <label>fullName</label>
            <input type="text" name="fullname"
id="fullname" required>
          </p>
          <p>
            <label>email id</label>
            <input type="text" name="email id"
id="email id">
          </p>
          <p>
            <label>Phone no</label>
            <input type="text" name="Phone no"
id="Phone no" required>
          </p>
          <p>
            <label>Address</label>
            <input type="text" name="Address"
id="Address">
          </p>
          <p class="full">
            <label>city</label>
             <input type="text" name="city"
id="city">
          </p>

           <p class="full">
            <label>Postal code</label>
            <input type="text" name="
Postal code" id="Postal code">
          </p>

          <p class="full">
        <button type="submit">Submit</button>
          </p>
        </form>
      </div>
    </div>
  </div>

  <script src="https://www.gstatic.com/
firebasejs/4.3.0/firebase.js"></script>
  <script src="db4.js"></script>
</body>
</html>

  How to create Order form using  html and CSS, JS

Output :-

order form


Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example