Skip to content
The Chat Archive
Perplexitysonar-reasoning· Perplexity LMArena Search Arena 24K

i would like to add to the web gallery ui component (switcher or a toggle) to change the…

  1. User

    i would like to add to the web gallery ui component (switcher or a toggle) to change the way images are fitted inside the square thumbnail container there are 2 option: - image is contained inside the thumbnail container (object-fit: contain) - image fills thumbnail container (object-fit: cover) which option. Is there a an icon pack that have suitable (appropriate ) icons?

  2. Assistant

    To implement a toggle between object-fit: contain and object-fit: cover in a gallery UI, several icon packs offer suitable options for representing these modes:


    Recommended Icon Packs

    1. Material Icons (Google)

      • crop or crop_free: Represents object-fit: cover (cropping to fill).
      • aspect_ratio or fit_screen: Symbolizes object-fit: contain (preserving aspect ratio).
    2. Font Awesome

      • fa-expand-arrows-alt (contain) vs. fa-crop-alt (cover).
      • fa-square (contain) vs. fa-square-full (cover).
    3. Heroicons

      • photo (contain) vs. adjustments (cover).
      • arrows-expand (contain) vs. crop (cover).
    4. Ionicons

      • resize (contain) vs. square (cover).

    Implementation Example

    <!-- Using Material Icons -->
    <button class="toggle-button" data-mode="contain">
    <span class="material-icons">aspect_ratio</span>
    </button>
    <button class="toggle-button" data-mode="cover">
    <span class="material-icons">crop</span>
    </button>
    
    /* CSS for toggling */
    .thumbnail-img {
      transition: object-fit 0.3s;
    }
    .thumbnail-img.contain { object-fit: contain; }
    .thumbnail-img.cover { object-fit: cover; }
    

    Custom SVG Icons (Alternative)

    For simplicity, you can create minimalist SVGs:

    • Contain: A square with a smaller centered rectangle (symbolizing letterboxing).
    • Cover: A square filled by a larger rectangle cropped at the edges.

    Key Considerations

    • Use standardized icons (e.g., crop for cover) to ensure user familiarity.
    • Pair labels like "Fit" (contain) and "Fill" (cover) for clarity.
    • Ensure the toggle updates object-fit dynamically via JavaScript.

    Most modern icon libraries include these options, so choose one that aligns with your design system.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.