@coveops/taxonomy-breadcrumb
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

TaxonomyBreadcrumb

Generates the appropriate permutation of breadcrumbs based on the specified field values, useful when needing to specify a hierarchy between those values.

This component is a result template component (see Result Templates).

This component handles both single and multi-value fields.

For example, using the following fields

  • @level1 = ['a', 'b']
  • @level2 = ['c', 'd']

along with the default separator will generate the following breadcrumbs based on the values of the specified fields:

  • a>c
  • a>d
  • b>c
  • b>d

Disclaimer: This component was built by the community at large and is not an official Coveo JSUI Component. Use this component at your own risk.

Getting Started

Testing the Component

For quick testing, you can add the script from unpkg:

<script src="https://unpkg.com/@coveops/taxonomy-breadcrumb@latest/dist/index.min.js"></script>

Disclaimer: Unpkg should be used for testing but not for production.

Using the Component

  1. Install the component into your project.

    npm i @coveops/taxonomy-breadcrumb
    
  2. Use the Component or extend it:

    Typescript

    import { TaxonomyBreadcrumb, ITaxonomyBreadcrumbOptions } from '@coveops/taxonomy-breadcrumb';

    Javascript

    const TaxonomyBreadcrumb = require('@coveops/taxonomy-breadcrumb').TaxonomyBreadcrumb;
  3. You can also expose the component alongside other components being built in your project.

    export * from '@coveops/taxonomy-breadcrumb'
  4. Include the component in your template as follows:

    Place the component in your markup:

    <div class="CoveoTaxonomyBreadcrumb" data-fields="@field1,@field2"></div>

Options

The following options can be configured:

Option Required Type Default Notes
fields Yes IFieldOption[ ] The field(s) used to create the breadcrumb
separator No string > The separator inserted between field values in the breadcrumb
label No string empty string This label is inserted in front of the breadcrumb. Can be styled using the .taxonomy-breadcrumb-label CSS class.

Extending

Extending the component can be done as follows:

import { TaxonomyBreadcrumb, ITaxonomyBreadcrumbOptions } from "@coveops/taxonomy-breadcrumb";

export interface IExtendedTaxonomyBreadcrumbOptions extends ITaxonomyBreadcrumbOptions {}

export class ExtendedTaxonomyBreadcrumb extends TaxonomyBreadcrumb {}

Contribute

  1. Clone the project
  2. Copy .env.dist to .env and update the COVEO_ORG_ID and COVEO_TOKEN fields in the .env file to use your Coveo credentials and SERVER_PORT to configure the port of the sandbox - it will use 8080 by default.
  3. Build the code base: npm run build
  4. Serve the sandbox for live development npm run serve

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.10latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.10
1.0.00

Package Sidebar

Install

npm i @coveops/taxonomy-breadcrumb

Weekly Downloads

0

Version

1.0.1

License

Apache-2.0

Unpacked Size

43.4 kB

Total Files

9

Last publish

Collaborators

  • iftekhar.ulhaq
  • cfosscoveo
  • belbizri
  • jantoun_coveo
  • ehsanshahneh
  • watallah
  • coveoit
  • gfoumbi
  • rvundavalli
  • sfecteau
  • jfleurent
  • jmdro
  • davebouffard
  • jfallaire
  • achouan
  • hsinghcoveo
  • elafleur_coveo
  • plavigueur
  • lpblais-coveo