Conditional filter options - view-a-LOD/Valeros GitHub Wiki

Sometimes, you might not want to show a filter option until another filter option value is enabled. In other words, you might want to show a filter option conditionally.

To do this, you can include a showOnlyForSelectedFilters condition in config/settings.tsfiltering/filterOptions.

As an example, to ensure that a License filter is displayed exclusively when a Type filter is enabled for visual material (e.g., sdo:Photograph, sdo:ImageObject, etc):

filtering: {
    filterOptions: {
        type: {
            label: 'Soort',
            fieldIds: typePredicates,
            values: [],
        },
        license: {
            label: 'Licentie',
            fieldIds: ['https://schema.org/license'],
            values: [],
            showOnlyForSelectedFilters: {
                visualMaterial: {
                    fieldIds: typePredicates,
                    valueIds: [
                        'https://schema.org/Drawing',
                        'https://schema.org/ImageObject',
                        'https://schema.org/Photograph',
                        'https://schema.org/VideoObject',
                        ...
                    ],
                    type: FilterType.FieldAndValue,
                },
            },
        },
    },
}
⚠️ **GitHub.com Fallback** ⚠️