Type: React component

How to get FxBooleanXPathQueryByNameFromSelection?


import FxBooleanXPathQueryByNameFromSelection from 'fontoxml-fx/src/FxBooleanXPathQueryByNameFromSelection.jsx'

Use this component to determine if the selection is in a specific xml element. Register xpath queries by name, the component will return children as a function which will have the same list of names with a true or false boolean value as parameter. The xpath queries will be executed from the selected element and should return a boolean. Each time the selection is moved in the document, the return value is updated.


// If there are buttons in the toolbar that need to be conditional on where the cursor is placed.
// Then the FxBooleanXPathQueryByNameFromSelection component can be used.

class ExampleToolbar extends Component {
	xpathQueryByName = {
		lcInteraction: 'ancestor-or-self::lcInteraction'

	render() {
			<FxBooleanXPathQueryByNameFromSelection xpathQueryByName={this.xpathQueryByName}>
				{({ xpathQueryResultByName }) => (
							{xpathQueryResultByName.lcInteraction && (
								<FxOperationButton operationName="insert-question" />


  1. children


    Type: Function

    Implement children as a function. The function should return a react component.



  2. xpathQueryByName


    Type: Object

    Register xpath queries by name.