Home > Net >  How to make a styled circle component using tailwindcss?
How to make a styled circle component using tailwindcss?

Time:04-08

I am working on image upload component in my react app and I design the image uploader component.

Here is the code and the result respectively.

<div className="px-8 py-6 mt-2 text-left bg-white shadow-lg">
        <form action="">
          <div >
            <label >
              <AddAPhotoIcon />
              <span >Upload Photo</span>
              <input type="file"  />
            </label>
          </div>
        </form>
      </div>

enter image description here

But I want change it exactly as the following component.

enter image description here

CodePudding user response:

Make sure you have the same width and height for the element you want circular, in combination with rounded-full.

I adapted your example and used h-40 and w-40 to control height and width. With rounded-full, the result is a circular component.

<div >
  <form action="">
    <label >
      <AddAPhotoIcon />
      <span >Upload Photo</span>
      <input type="file"  />
    </label>
  </form>
</div>
  • Related