Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@elastic/react-search-ui-views

elastic185.3kApache-2.01.23.1TypeScript support: included

A collection of React UI components for building search experiences

readme

react-search-ui-views

Part of the Search UI project.

This is the view layer for react-search-ui.

This library provides view implementations for all of React Search UI's components along with corresponding CSS, and a few layout components.

The components provided here have no logic behind them, they are simple, stateless, view-only components.

Usage

import React from "react";
import {
  Layout,
  PagingInfo,
  Result,
  SearchBox
} from "@elastic/react-search-ui-views";
import "@elastic/react-search-ui-views/lib/styles/styles.css";

export default function App() {
  return (
    <div>
      <Layout
        header={<SearchBox value="test" />}
        bodyHeader={
          <div className="meta">
            <PagingInfo
              end={10}
              searchTerm={"test"}
              start={1}
              totalResults={100}
            />
          </div>
        }
        bodyContent={
          <div>
            <Result
              title="A Result"
              fields={{ description: "This is an example of a result" }}
            />
          </div>
        }
      />
    </div>
  );
}

Storybook

A visual component reference is available locally. It is built with Storybook, and can be run locally with the following command:

npm run storybook

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


[1.23.0] - 2025-04-01

✨ Added

  • Added the ability to preserve selected filters when performing a new search. This provides more flexibility in managing filter states between queries. #1131
    Related to #89
  • Introduced useSearch hook for React functional components. #1130
  • Added APIProxyConnector to the Elasticsearch Connector to enable server-side integration using Node.js and Express. This enhances security by hiding API keys and other sensitive data. #1126
  • Added TypeScript support to the sandbox example. #1126
  • Updated sandbox structure, React version, and example organization. #1126

🐛 Fixed

  • Fixed export module compatibility issues by introducing bundling using tsup, ensuring correct behavior in both ESM and CommonJS environments. #1114
    Fixes #1046
  • Fixed sorting logic when using sortField and sortDirection in state. Addressed inconsistencies in setSort() behavior. #1112
    Fixes #1109
  • Fixed issue in BooleanFacet for numeric facet values (e.g., 0/1 or true/false), improving compatibility with Elasticsearch Connector. #1111
    Fixes #851

🧹 Removed

  • Removed “Technical preview” label for Elasticsearch Connector as it is now generally available (GA). 🎉 #1125
  • Deprecated @elastic/search-ui-analytics-plugin package. #1120

🛠 Internal

  • Switched to tsup for consistent module bundling across packages. #1114
  • Applied shared TypeScript and bundling configurations across the repo. #1114