Skip to content

feat: introducing custom_search_form slot in the header component#4024

Open
marianayovcheva wants to merge 1 commit into
mainfrom
feat/custom-search-form-header
Open

feat: introducing custom_search_form slot in the header component#4024
marianayovcheva wants to merge 1 commit into
mainfrom
feat/custom-search-form-header

Conversation

@marianayovcheva
Copy link
Copy Markdown
Contributor

@marianayovcheva marianayovcheva commented Mar 17, 2026

I am working on introducing a search autocomplete field in the header. The autocomplete is a product related change and even if at some point we decide to introduce it in the design system it might be a while until we do so. In the product I wanted to change what we pass to the HeaderSearch slot of the Header component. The problem is that I then had to copy the whole html.erb file.
To make the header more flexible to such changes, this PR adds a custom_search_form slot to the header. But my main question is does this allow too much freedom to what can be added to the component.

Other approaches I've thought about while working on the change:

  • Extract HeaderSearchForm into its own component - this way it would have this would solve most of problems. The reason I didn't go for it was because I wasn't sure if it's generally okay to have a sub component and I didn't know if we'd need to make a separate page on the docs site for it
  • have a call block in the HeaderSearch block where the user could optionally add content (similar to the AccountLink slot). The problem with this is that unlike the other slots that use the logic, we have a fair bit of html to transfer and it felt wrong to bring it in the component file and not the template one.

As an aside, was also tempted to just use the CitizensAdviceComponents::Search instead of the form with input and button, but realised that the way that the classes are passed is different and there is also a search icon, but I guess it's a candidate for making our search inputs more consistent.

@marianayovcheva marianayovcheva force-pushed the feat/custom-search-form-header branch from e80d0c5 to 371b2f9 Compare March 17, 2026 15:21
@marianayovcheva marianayovcheva added the docs preview If this is added a preview version of the docs site will be deployed label Mar 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Netlify deployed citizens-advice-design-system as draft

https://69b9740175d69f591eb3570a--citizens-advice-design-system.netlify.app

@marianayovcheva marianayovcheva marked this pull request as ready for review March 17, 2026 16:14
@marianayovcheva marianayovcheva requested a review from a team as a code owner March 17, 2026 16:14
@marianayovcheva marianayovcheva requested a review from leeky March 17, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs preview If this is added a preview version of the docs site will be deployed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant