Aller au contenu

🪧 En-têtes (headers)Gratuit · 0 NahnahPar NAHNAH AI

En-tête grande recherche

Grande barre de recherche au centre de l’en-tête et liens principaux en pastilles défilantes : idéal pour les boutiques avec beaucoup de produits.

Aperçu en direct

Données de démonstration (produits, menus, textes d’exemple) : dans ta boutique, ce sont les tiennes.

Photos : Unsplash / Pexels (exemples de l’aperçu, jamais inclus dans le code).

Code à copier

Fichier complet sections/nahnah-menu-barre-recherche.liquid (Liquid, CSS et JS inclus).

{%- comment -%} NAHNAH AI · En-tête grande recherche (bibliothèque Sections & effets) {%- endcomment -%}
<div class="nn-menu-barre-recherche" style="--nn-mh: {{ section.settings.marge_haut }}px; --nn-mb: {{ section.settings.marge_bas }}px; --nn-fond: {{ section.settings.couleur_fond }}; --nn-texte: {{ section.settings.couleur_texte }}; --nn-accent: {{ section.settings.couleur_accent }}; --nn-bouton: {{ section.settings.couleur_bouton }}; --nn-texte-bouton: {{ section.settings.couleur_texte_bouton }}; --nn-logo: {{ section.settings.logo_largeur }}px;">
  <div class="nn-menu-barre-recherche__haut">
    <a class="nn-menu-barre-recherche__logo" href="{{ routes.root_url }}">
      {%- if section.settings.logo_actif and section.settings.logo != blank -%}
        {{ section.settings.logo | image_url: width: 520 | image_tag: class: 'nn-menu-barre-recherche__logo-img', alt: shop.name, sizes: '260px', widths: '130, 260, 520' }}
      {%- else -%}
        <span class="nn-menu-barre-recherche__nom">{{ shop.name | escape }}</span>
      {%- endif -%}
    </a>
    <form class="nn-menu-barre-recherche__recherche" action="{{ routes.search_url }}" method="get" role="search">
      <label class="nn-menu-barre-recherche__vh" for="NnRecherche-{{ section.id }}">Rechercher dans la boutique</label>
      <input class="nn-menu-barre-recherche__champ" id="NnRecherche-{{ section.id }}" type="search" name="q" placeholder="{{ section.settings.placeholder | escape }}" autocomplete="off">
      <input type="hidden" name="options[prefix]" value="last">
      <button class="nn-menu-barre-recherche__go" type="submit" aria-label="Lancer la recherche"><svg class="nn-menu-barre-recherche__ico" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></button>
    </form>
    <div class="nn-menu-barre-recherche__icones">
      
      {%- if section.settings.compte -%}<a class="nn-menu-barre-recherche__icone nn-menu-barre-recherche__icone--compte" href="{{ routes.account_url }}" aria-label="Mon compte"><svg class="nn-menu-barre-recherche__ico" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg></a>{%- endif -%}
      <a class="nn-menu-barre-recherche__icone nn-menu-barre-recherche__panier" href="{{ routes.cart_url }}" aria-label="Panier : {{ cart.item_count }} article{% if cart.item_count > 1 %}s{% endif %}">
        <svg class="nn-menu-barre-recherche__ico" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 8h14l-1.2 12.1a1 1 0 0 1-1 .9H7.2a1 1 0 0 1-1-.9L5 8z"/><path d="M9 8V7a3 3 0 0 1 6 0v1"/></svg>
        {%- if cart.item_count > 0 -%}<span class="nn-menu-barre-recherche__compteur" aria-hidden="true">{{ cart.item_count }}</span>{%- endif -%}
      </a>
    </div>
  </div>
  <nav class="nn-menu-barre-recherche__nav" aria-label="Menu principal">
    <ul class="nn-menu-barre-recherche__pastilles" role="list">
      {%- for link in section.settings.menu.links -%}
        <li><a class="nn-menu-barre-recherche__pastille" href="{{ link.url }}"{% if link.current or link.child_active %} aria-current="page"{% endif %}>{{ link.title | escape }}</a></li>
      {%- endfor -%}
    </ul>
  </nav>
</div>

{% schema %}
{
  "name": "En-tête grande recherche",
  "tag": "header",
  "class": "nn-section-menu-barre-recherche",
  "settings": [
    {
      "type": "link_list",
      "id": "menu",
      "label": "Menu",
      "default": "main-menu"
    },
    {
      "type": "checkbox",
      "id": "logo_actif",
      "label": "Afficher le logo (image) au lieu du nom",
      "default": false
    },
    {
      "type": "image_picker",
      "id": "logo",
      "label": "Logo"
    },
    {
      "type": "range",
      "id": "logo_largeur",
      "label": "Largeur du logo",
      "min": 60,
      "max": 260,
      "step": 10,
      "default": 120,
      "unit": "px"
    },
    {
      "type": "checkbox",
      "id": "compte",
      "label": "Afficher l’icône du compte client",
      "default": true
    },
    {
      "type": "text",
      "id": "placeholder",
      "label": "Texte indicatif de la recherche",
      "default": "Rechercher un produit, une marque…"
    },
    {
      "type": "header",
      "content": "Couleurs"
    },
    {
      "type": "color",
      "id": "couleur_fond",
      "label": "Fond",
      "default": "#FFFFFF"
    },
    {
      "type": "color",
      "id": "couleur_texte",
      "label": "Texte",
      "default": "#1B1F24"
    },
    {
      "type": "color",
      "id": "couleur_accent",
      "label": "Accent",
      "default": "#0A66D9"
    },
    {
      "type": "color",
      "id": "couleur_bouton",
      "label": "Bouton et pastille du panier",
      "default": "#0A66D9"
    },
    {
      "type": "color",
      "id": "couleur_texte_bouton",
      "label": "Texte du bouton",
      "default": "#FFFFFF"
    },
    {
      "type": "header",
      "content": "Espacement"
    },
    {
      "type": "range",
      "id": "marge_haut",
      "label": "Marge haute",
      "min": 0,
      "max": 120,
      "step": 4,
      "unit": "px",
      "default": 0
    },
    {
      "type": "range",
      "id": "marge_bas",
      "label": "Marge basse",
      "min": 0,
      "max": 120,
      "step": 4,
      "unit": "px",
      "default": 0
    }
  ],
  "presets": [
    {
      "name": "En-tête grande recherche"
    }
  ]
}
{% endschema %}

{% stylesheet %}
.nn-menu-barre-recherche {
  position: relative;
  z-index: 20;
  display: block;
  padding: var(--nn-mh) 0 var(--nn-mb);
  background: var(--nn-fond);
  color: var(--nn-texte);
  overflow-x: clip;
}
.nn-menu-barre-recherche *, .nn-menu-barre-recherche *::before, .nn-menu-barre-recherche *::after { box-sizing: border-box; }
.nn-menu-barre-recherche :where(a, button, summary, input):focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 2px; }
.nn-menu-barre-recherche summary { list-style: none; cursor: pointer; }
.nn-menu-barre-recherche summary::-webkit-details-marker { display: none; }
.nn-menu-barre-recherche__vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nn-menu-barre-recherche__logo { display: inline-flex; align-items: center; min-width: 0; min-height: 44px; color: inherit; text-decoration: none; }
.nn-menu-barre-recherche__logo-img { display: block; width: var(--nn-logo, 120px); max-width: 100%; height: auto; max-height: 56px; object-fit: contain; object-position: left center; }
.nn-menu-barre-recherche__nom { overflow: hidden; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; text-overflow: ellipsis; }
.nn-menu-barre-recherche__icones { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.nn-menu-barre-recherche__icone { position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; color: inherit; text-decoration: none; transition: background-color 0.2s ease; }
@media (hover: hover) { .nn-menu-barre-recherche__icone:hover { background: color-mix(in srgb, var(--nn-texte) 8%, transparent); } }
.nn-menu-barre-recherche__ico { width: 22px; height: 22px; }
.nn-menu-barre-recherche__compteur {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--nn-bouton);
  color: var(--nn-texte-bouton);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  animation: nn-menu-barre-recherche-compteur 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes nn-menu-barre-recherche-compteur { from { transform: scale(0.4); } }
@media (max-width: 380px) { .nn-menu-barre-recherche__icone--compte { display: none; } }
.nn-menu-barre-recherche { border-bottom: 1px solid color-mix(in srgb, var(--nn-texte) 10%, transparent); }
.nn-menu-barre-recherche__haut { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "logo recherche icones"; align-items: center; gap: 12px 24px; max-width: 1320px; margin: 0 auto; padding: 12px 16px; }
.nn-menu-barre-recherche__logo { grid-area: logo; }
.nn-menu-barre-recherche__icones { grid-area: icones; }
.nn-menu-barre-recherche__recherche { grid-area: recherche; position: relative; display: flex; align-items: center; width: 100%; max-width: 720px; margin: 0 auto; }
.nn-menu-barre-recherche__champ { width: 100%; min-width: 0; height: 48px; padding: 0 56px 0 20px; border: 2px solid color-mix(in srgb, var(--nn-texte) 14%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--nn-texte) 4%, var(--nn-fond)); color: inherit; font: inherit; font-size: 16px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.nn-menu-barre-recherche__champ::placeholder { color: inherit; opacity: 0.55; }
.nn-menu-barre-recherche__champ:focus { outline: none; border-color: var(--nn-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--nn-accent) 20%, transparent); }
.nn-menu-barre-recherche__go { position: absolute; right: 4px; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--nn-bouton); color: var(--nn-texte-bouton); cursor: pointer; }
.nn-menu-barre-recherche__go .nn-menu-barre-recherche__ico { width: 20px; height: 20px; }
.nn-menu-barre-recherche__nav { max-width: 1320px; margin: 0 auto; padding: 0 16px 12px; }
.nn-menu-barre-recherche__pastilles { display: flex; gap: 8px; margin: 0; padding: 2px 0; overflow-x: auto; list-style: none; scrollbar-width: none; overscroll-behavior-x: contain; }
.nn-menu-barre-recherche__pastilles::-webkit-scrollbar { display: none; }
.nn-menu-barre-recherche__pastille { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid color-mix(in srgb, var(--nn-texte) 14%, transparent); border-radius: 999px; color: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background-color 0.2s ease, border-color 0.2s ease; }
@media (hover: hover) { .nn-menu-barre-recherche__pastille:hover { border-color: var(--nn-accent); } }
.nn-menu-barre-recherche__pastille[aria-current="page"] { border-color: var(--nn-texte); background: var(--nn-texte); color: var(--nn-fond); }
@media (max-width: 749px) {
  .nn-menu-barre-recherche__haut { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "logo icones" "recherche recherche"; }
}
@media (prefers-reduced-motion: reduce) {
  .nn-menu-barre-recherche, .nn-menu-barre-recherche *, .nn-menu-barre-recherche *::before, .nn-menu-barre-recherche *::after {
    animation: none !important;
    transition: none !important;
  }
}
{% endstylesheet %}
Télécharger le fichier .liquid

Licence NAHNAH AI : utilisation libre dans tes boutiques (y compris commerciales), modification permise, revente de l’élément seul interdite.

Prompt à copier

À coller dans Claude ou ChatGPT avec le fichier téléchargé (ou le code copié) : l’assistant t’aide à l’installer et à l’adapter à ta marque.

Tu es un expert des thèmes Shopify Online Store 2.0. Aide-moi à installer puis à adapter à ma marque cet élément gratuit de la bibliothèque NAHNAH AI.

Élément : « En-tête grande recherche » (En-têtes (headers))
Description : Grande barre de recherche au centre de l’en-tête et liens principaux en pastilles défilantes : idéal pour les boutiques avec beaucoup de produits.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/menu-barre-recherche
Fichier : nahnah-menu-barre-recherche.liquid (bouton « Télécharger » de la page) ou le code copié avec le bouton « Copier » : je te le joins ou je le colle après ce message.
Emplacement dans le thème : sections/nahnah-menu-barre-recherche.liquid (Liquid, puis {% stylesheet %} et {% javascript %}, dans ce seul fichier).

Étapes d’installation :
1. Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
2. Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-menu-barre-recherche ».
3. Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
4. Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.

Ce que j’attends de toi :
- Guide-moi pas à pas dans Shopify : Boutique en ligne → Thèmes → « … » → Modifier le code → dossier sections → Ajouter une section, puis Personnaliser → Ajouter une section.
- Propose-moi d’adapter les couleurs, les textes et les liens à ma marque : demande d’abord mes couleurs (codes hexadécimaux), mon ton et mes liens.
- Garde le bloc {% schema %} et tous ses réglages (identifiants, types, presets) : je dois pouvoir tout régler ensuite dans l’éditeur de thème.
- Rends-moi le fichier complet modifié, prêt à coller, sans faux avis, fausse urgence ni chiffre inventé.

Si tu as le connecteur NAHNAH AI (MCP), récupère directement le code exact avec l’outil obtenir_code_element (id : menu-barre-recherche).

Installer dans ma boutique

En un clic, la section est ajoutée à un thème de ta boutique Shopify connectée (un thème non publié par défaut).

Chargement de tes boutiques…

Installer dans Shopify

  1. Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
  2. Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-menu-barre-recherche ».
  3. Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
  4. Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.

Installer via le MCP

Depuis Claude, Claude Code ou ChatGPT connecté à NAHNAH AI, demande : « Donne-moi le code de l’élément menu-barre-recherche de la bibliothèque NAHNAH AI et les étapes pour l’installer ». L’assistant récupère le code et les étapes (outil obtenir_code_element), gratuitement.

Boutique connectée à NAHNAH AI : l’assistant peut aussi l’installer directement (outil installer_element).

Connecter le MCP

Dans la même catégorie