Skip to content

Utilise DataViews in Pattern / Template part browsing modals #39308

Open

Description

@jameskoster

There are a couple of places where Patterns and/or Template Parts appear in modals, specifically the Pattern Explorer and the Template Part replacement flow.

Edit: Now also when creating pages, and working with empty Query blocks.

Pattern Explorer

Screenshot 2022-03-09 at 10 41 22

Template Part replacement

Screenshot 2022-03-09 at 10 41 01

As we apply this UX across different flows throughout the editor, there are a couple of issues we might consider addressing sooner rather than later.

Sizing

Patterns and Template Parts can often be large, so it's probably worthwhile mimicking the sizing from the Pattern Explorer in other instances. We may even want to revisit the full screen modal component concept in order to make the maximum use of space: #28574.

Consistent sizing will help make the overall UX feel more familiar and robust.

View options

Patterns come in all shapes and sizes so a strict layout for displaying them doesn't always work so well, even with a larger modal. As an example, the three column layout in the Pattern Explorer works well for the "Pages" pattern category, but less well for "Footers".

Pages Footers
Screenshot 2022-03-09 at 10 50 18 Screenshot 2022-03-09 at 10 50 35

One option would be to employ a zoom scale so that folks can adjust the display based on the types of patterns they're browsing. Similar to apps like Apple Photos:

zoom.mp4

Todo:

Activity

  1. added
    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced
    on Mar 9, 2022
  2. richtabor commented on May 13, 2022

    @richtabor
    Member

    I spun up a related issue here, but I'll close it and add my conclusions here (in addition to what @jameskoster is suggesting):

    1. Remove single-view from __experimentalBlockPatternSetup

    Take the block pattern selector (__experimentalBlockPatternSetup) and make it back to a grid view (not the current single pattern view). Consider even removing the single view entirely (not sure how helpful that is).

    2. Possibly add another level of categorization for blockTypes

    Consider adding a sub-categorization layer to blockTypes, which could be very similar to the current Pattern Explorer UI does (sidebar with search + category)). This would be particularly useful for the "Add new" pattern view, where I could select the type of page to add, instead of seeing an uncategorized list of page patterns.

    This could also be interesting for the Query block's __experimentalBlockPatternSetup use case as well, where the query patterns could be categorized by column count, featured images, grid, etc. (If this is interesting, we should probably spin up another issue relative to this).

  3. jameskoster commented on May 13, 2022

    @jameskoster
    ContributorAuthor

    +1 on the additional categorisation. It will be necessary in order for initiatives like #41060 to be successful.

  4. jameskoster commented on May 16, 2022

    @jameskoster
    ContributorAuthor

    Prior to working on designs for a holistic pattern browsing component I figured it would make sense to list where we need to display patterns this way, and determine which features would be useful in each case.

    Use case Useful Features
    Pattern Explorer
    Displays the full catalog of patterns
    - Zoomable grid view
    - Sorting / Filtering
    - Search
    Template part replacement
    Displays contextual patterns (IE template headers / footers)
    - Search
    - Zoomable grid view
    - Carousel view
    Creating a page
    Displays full-page layout patterns
    - Sorting / Filtering
    - Search
    - Zoomable grid view
    Creating a template
    Displays contextual template patterns (e.g a full 404 template)
    - Search
    - Zoomable grid view
    - Carousel view
    Inserting a Query
    Displays contextual patterns for displaying post lists
    - Search
    - Zoomable grid view
    - Carousel view

    Search and some kind of zoomable grid should be prioritised since every application will make use of these features. The carousel view is conditional but worth keeping as an option imo. Filtering / sorting is critical to non-contextual flows.

    I plan to work on some designs this week, but keen to gather more input in the mean time.

  5. jameskoster commented on May 20, 2022

    @jameskoster
    ContributorAuthor

    Here's an example modal that makes use of all of the features we use across the pattern browsing experiences in Gutenberg:

    pattern-modal.mp4

    It should be possible to toggle the individual features depending on the use case as illustrated in the examples below, but the modal dimensions and feature behaviours remain consistent.

    Template part replacement

    Screenshot 2022-05-20 at 15 06 09

    Here filtering is omitted because context is provided by the template part being replaced. We default to carousel view, but it's still possible to switch to grid view.

    Pattern explorer

    Screenshot 2022-05-20 at 17 09 56

    Carousel view is disabled because generally there are too many patterns for it to be useful.

    Creating a page

    Screenshot 2022-05-20 at 17 01 27

    Here the side panel makes use of the drilldown component for nested filtering.

    Creating a template / template part (header)

    Screenshot 2022-05-20 at 17 12 30

  6. Mamaduka commented on Jul 15, 2022

    @Mamaduka
    Member

    I plan to work and apply suggested features to the Pattern Explorer modal first. Then, when I'm more familiar with the code base, I can give you a better answer if it's worth making an abstraction of this component.

  7. annezazu commented on Dec 19, 2022

    @annezazu
    Contributor

    I wanted to bring in feedback from the nineteenth call for testing for the FSE Outreach Program:

    I may have mentioned this previously in another testing, but being dropped on the “single view” when picking a different pattern makes it hard for me to even recognize that there are other options. The arrows are small and in the bottom left corner. I’d suggest starting on the “grid” view and giving people the option to click to see the single view.

    As we think about aligning these various interfaces, I wanted to mention how the current experience feels. Something to consider, especially when thinking about wanting users to unlock the power of patterns rather than just thinking there's only one option potentially.

  8. richtabor commented on Dec 20, 2022

    @richtabor
    Member

    I like the idea of one component that can be flexed to support the multiple pattern selection scenarios.

    We should decide if we want to separate the presentation of full page vs. single patterns. Do we need a hierarchy category system for page patterns? Or should the new page modal just show the pattern's assigned categories (Text, Image, etc)?

    Should there be a secondary page-specific category nomenclature for this modal?

    Re the column control; it would be great if you could pass the desired column count for the modal.

  9. richtabor commented on Dec 11, 2023

    @richtabor
    Member

    Should there be a secondary page-specific category nomenclature for this modal?

    No need for secondary/sub categories, we can use the existing categories. Wrote an issue for this: #56944

  10. youknowriad commented on Jul 15, 2024

    @youknowriad
    Contributor

    Found this issue while triaging. I think there's an opportunity to use DataViews to power and unify all these UIs.

  11. jameskoster commented on Jul 15, 2024

    @jameskoster
    ContributorAuthor

    Yeah this issue was basically a pre-cursor to data views. Perhaps we should close it, review each such modal and create issues for those that could be migrated to data views?

  12. changed the title [-]Align pattern / template part modal dimensions, and add view options[/-] [+]Utilise DataViews in Pattern / Template part browsing modals[/+] on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions