Search code examples
reactjsblueprintjs

Is the Blueprintjs navbar CSS only?


After installing the Blueprintjs core package I wanted to get started with the Navbar component but when I import it, it is not found within the node module.

In the github repo there is only a SCSS file in the component's directory while in the docs a Navbar component is mentioned which makes me doubt.

Are not all components React components?

Thanks


Solution

  • Yes, .pt-navbar is CSS only. There is no Navbar React component because there's no fancy logic, just a bunch of class names.

    You can use the constants defined in Blueprint.Core.Classes to simplify the rendering. See https://github.com/palantir/blueprint/blob/release-1.13.0/packages/core/src/common/classes.ts#L100-L103.

    (EDIT: Components declare whether they provide a JavaScript API, CSS API, or both. Just look at the headings.)

    Update: I merged the new answer of Chris Lewis in the accepted answer because the existing accepted answer is no longer valid for the latest version of Blueprintjs:

    The Navbar component now offers a JS API as of @blueprintjs/core v1.34.0 (release | PR).