About this set
Image uploaders that show the picture straight away. Photo grid with thumbnails is built for listings and galleries: chosen photos appear as square thumbnails with a round remove button in the corner, the first one carries a Cover badge, a counter reads 4 of 8, and the last tile is a dashed Add photos target that accepts clicks and dropped files. Cover image with replace and remove is a wide banner zone for an event or profile header: empty, it asks for an image and suggests 1600 by 700 pixels; filled, it shows the preview edge to edge with a dark bar holding the file name and size, a Replace hint and a Remove button. Previews come from URL.createObjectURL, so nothing is uploaded to show them, and each object URL is revoked when its image is removed or replaced. The script checks the MIME type against the accept list and the size against data-max-size, reports rejected files by name, and keeps input.files equal to the images on screen with DataTransfer. Use the grid wherever people upload several photos, and the cover zone for a single hero image.
What’s included
- Instant previews with URL.createObjectURL, revoked on remove
- Photo grid with remove buttons, a Cover badge and a counter
- Add tile and cover zone that accept dropped images
- Cover image with Replace and Remove
- Type, size and photo-count checks
Accessibility
Each thumbnail uses the file name as its alt text and its remove button is named Remove plus the file name. The add tile and the cover zone are real file inputs with visible or associated labels and a focus ring on the visible tile. Added, removed and rejected files are announced in a polite live region, and focus moves to the next remove button after a removal. Transitions switch off under prefers-reduced-motion.
Customise it
Change --ip-accent, --ip-tint, --ip-line and --ip-radius on .ip, the tile size in the grid's minmax(112px, 1fr), and the limits with accept, data-max-size and data-max-files. Bootstrap uses .btn-close and .badge; Tailwind reads the ip colours from @theme.





