Fluentui: Command Bar onSearch?

Created on 29 Mar 2017  路  4Comments  路  Source: microsoft/fluentui

Looking at the docs:

https://dev.office.com/fabric#/components/commandbar

It seems like the Command Bar's search feature has no trigger command built in. Which is kind of odd, not sure how we're supposed to use a searchbox with no onSearch callback!

For now I'm just using this as a workaround:

    public componentDidMount() {
        let searchBox = document.querySelectorAll(".parentContainer .ms-CommandBarSearch-input");
        if (searchBox.length) {
            let inputBox = searchBox.item(0) as HTMLInputElement;
            inputBox.onkeydown = (e: Event) => {
                // Do Search
            }
        }
    }

I might have missed something here, so let me know if that's the case. Otherwise I have a feature request: add an onSearch property to the command bar.

Most helpful comment

Any news on this matter ?

All 4 comments

We have plans to replace the command bar search bar with our search component. So if you have a working workaround we probably won't fix this.

Any news on this matter ?

Any updates regarding onSearch()?

in Fabric 6.0 (in beta now, and soon to be released) you'll be able to drop in your own searchbox with all of the necessary searchbox props. This old approach is being deprecated (as it never worked anyway)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prashkan picture prashkan  路  3Comments

rickyp-ms picture rickyp-ms  路  3Comments

luisrudge picture luisrudge  路  3Comments

mattcoxonline picture mattcoxonline  路  3Comments

carruthe picture carruthe  路  3Comments