Logo : Menu Transitions Rtl

Menu Transitions Rtl

Communauté
asmyshlyaev177
menu-transitions-rtl

Animez le défilement de react-horizontal-scrolling-menu et créez des menus de droite à gauche : noPolyfill vaut true par défaut depuis la v8. Par conséquent, transitionDuration (500 par défaut), un transitionBehavior avec une fonction d’accélération personnalisée et les ScrollOptions { duration, boundary } définies pour chaque appel à scrollToItem/scrollNext/scrollPrev sont ignorées silencieusement, sauf si noPolyfill={false} (les comportements sous forme de chaînes 'smooth' | 'auto' sont toujours transmis à scrollIntoView natif). La prop RTL (qui ajoute uniquement une classe CSS direction: rtl) a ses limites : ne la combinez jamais avec les props de transition. À utiliser lorsque la vitesse ou l’accélération de l’animation de défilement n’a aucun effet, pour personnaliser les transitions ou créer des menus RTL.

Add to TypingMind

Présentation

Éditeurasmyshlyaev177
Dépôtreact-horizontal-scrolling-menu
Nom de la compétencemenu-transitions-rtl
Étoiles
790
Forks
101
Fichiers inclus
Instructions uniquement
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Tout dans les instructions

    Tout ce dont le modèle a besoin se trouve dans les instructions : aucun fichier supplémentaire à synchroniser.

  • Open source

    Publiée par asmyshlyaev177 sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Menu Transitions Rtl dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu/tree/master/skills/menu-transitions-rtl
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu.git /tmp/react-horizontal-scrolling-menu
mkdir -p .claude/skills
cp -r /tmp/react-horizontal-scrolling-menu/skills/menu-transitions-rtl .claude/skills/menu-transitions-rtl
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Menu Transitions Rtl dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Menu Transitions Rtl dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Menu Transitions Rtl n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

react-horizontal-scrolling-menu — Transitions and RTL

The single most important fact: noPolyfill defaults to true since v8.0.0 (src/index.tsx:183). With the default, every scroll uses native Element.scrollIntoView: transitionDuration, a function-valued transitionBehavior, and ScrollOptions duration/boundary are silently discarded (src/helpers.tsx:72-77). Only the string behaviors 'smooth'/'auto' survive — they are forwarded to the native call, with 'smooth' as the fallback (src/helpers.tsx:60-73). Any duration/easing work starts by setting noPolyfill={false}, which routes scrolling through the smooth-scroll-into-view-if-needed polyfill. The one exception: RTL menus must keep the default (see Tensions).

Setup

Animated transitions, minimum viable:

tsx
import React from 'react';
import {
  ScrollMenu,
  VisibilityContext,
  type publicApiType,
} from 'react-horizontal-scrolling-menu';
import 'react-horizontal-scrolling-menu/dist/styles.css';

function LeftArrow() {
  const api = React.useContext<publicApiType>(VisibilityContext);
  const disabled = api.useLeftArrowVisible();
  return (
    <button disabled={disabled} onClick={() => api.scrollPrev()}>
      Left
    </button>
  );
}

function RightArrow() {
  const api = React.useContext<publicApiType>(VisibilityContext);
  const disabled = api.useRightArrowVisible();
  return (
    <button disabled={disabled} onClick={() => api.scrollNext()}>
      Right
    </button>
  );
}

// itemId must stay on the component's props (ScrollMenu reads it);
// do not spread it onto the DOM node.
function Card({ title }: { itemId: string; title: string }) {
  return <div style={{ width: '160px', margin: '0 10px' }}>{title}</div>;
}

const items = Array.from({ length: 10 }, (_, i) => ({ id: `item-${i}` }));

export function AnimatedMenu() {
  return (
    <ScrollMenu
      LeftArrow={LeftArrow}
      RightArrow={RightArrow}
      noPolyfill={false} // REQUIRED — transition props are no-ops without it
      transitionDuration={1200} // ms, default 500
      transitionBehavior="smooth"
    >
      {items.map(({ id }) => (
        <Card itemId={id} key={id} title={id} />
      ))}
    </ScrollMenu>
  );
}

Patterns below reuse LeftArrow, RightArrow, Card, items, and the import block from this Setup.

Core Patterns

The noPolyfill gate — which engine scrolls

noPolyfillEngineTransition controlsRTL
true (default)native Element.scrollIntoViewduration/boundary/function behavior ignored; string behavior still appliescorrect
falsesmooth-scroll-into-view-if-needed polyfillall honoredbuggy — never combine

Resolution chains in polyfill mode (src/createApi.ts:120-160,316-336, src/helpers.tsx:60):

  • behavior: positional argument → transitionBehavior prop → 'smooth'
  • duration: ScrollOptions.duration → transitionDuration prop → 500
  • boundary: ScrollOptions.boundary → the menu's own scroll container (src/index.tsx:250)

Custom easing function via transitionBehavior

A function transitionBehavior receives the computed scroll targets and drives scrollLeft itself — any curve or animation library works from there. Polyfill mode only.

tsx
// What scroll-into-view-if-needed hands to a custom behavior: one action per
// scrollable ancestor that must move — here always just the scroll container,
// because the menu passes it as `boundary`.
type ScrollAction = { el: Element; top: number; left: number };

const easeInOutCubic = (t: number) =>
  t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;

// A second arrow click can land mid-animation; remembering the pending frame
// per element lets the new animation cancel the old one instead of both
// fighting over scrollLeft.
const pendingFrames = new WeakMap<Element, number>();

function animateScroll(el: Element, target: number, duration: number) {
  const prevFrame = pendingFrames.get(el);
  if (prevFrame !== undefined) cancelAnimationFrame(prevFrame);

  const from = el.scrollLeft;
  const startTime = performance.now();

  const step = (now: number) => {
    const progress = Math.min((now - startTime) / duration, 1);
    el.scrollLeft = from + (target - from) * easeInOutCubic(progress);
    if (progress < 1) {
      pendingFrames.set(el, requestAnimationFrame(step));
    } else {
      pendingFrames.delete(el);
    }
  };

  pendingFrames.set(el, requestAnimationFrame(step));
}

const transition = (instructions: ScrollAction[]) =>
  instructions.forEach(({ el, left }) => animateScroll(el, left, 1200));

export function CustomEasingMenu() {
  return (
    <ScrollMenu
      LeftArrow={LeftArrow}
      RightArrow={RightArrow}
      noPolyfill={false} // custom easing only runs through the polyfill
      // The typings describe the options-object form, but the menu passes this
      // value straight to scroll-into-view-if-needed as its behavior callback.
      transitionBehavior={transition as unknown as ScrollBehavior}
    >
      {items.map(({ id }) => (
        <Card itemId={id} key={id} title={id} />
      ))}
    </ScrollMenu>
  );
}

Live-editable version: the CustomTransition Storybook story.

Per-call override with ScrollOptions

ScrollOptions is the last argument of scrollToItem, scrollNext, and scrollPrev; its duration/boundary override the menu-level transition props for that one call (polyfill mode only):

tsx
function CenteringCard({ title, itemId }: { itemId: string; title: string }) {
  const api = React.useContext<publicApiType>(VisibilityContext);

  const center = () =>
    // behavior inside the options object is required by the type but the
    // positional 'smooth' always wins — only duration/boundary take effect.
    api.scrollToItem(api.getItemById(itemId), 'smooth', 'center', 'nearest', {
      behavior: 'smooth',
      duration: 800, // overrides transitionDuration for this call only
    });

  return (
    <div onClick={center} style={{ width: '160px', margin: '0 10px' }}>
      {title}
    </div>
  );
}

scrollNext/scrollPrev type their options as Omit<scrollToItemOptions, 'behavior'> (src/createApi.ts:18), so there { duration: 800 } alone compiles:

tsx
function SlowNextArrow() {
  const api = React.useContext<publicApiType>(VisibilityContext);
  const disabled = api.useRightArrowVisible();
  return (
    <button
      disabled={disabled}
      onClick={() =>
        api.scrollNext('smooth', 'start', 'nearest', { duration: 800 })
      }
    >
      Right
    </button>
  );
}

RTL menu

The RTL prop does exactly one thing: it appends the rtl class to the scroll container (src/index.tsx:306-307), which styles.css maps to direction: rtl (src/styles.css:9-11). Item order and scrolling are native browser RTL behavior. Keep the noPolyfill default and pass no transition props. Swap the arrow slots so the advancing arrow sits visually left (in RTL the row starts at the right edge and later items extend leftwards):

tsx
export function RTLMenu() {
  return (
    // Visual left = logical end in RTL, so the slots swap components.
    // Each arrow keeps its own hook/handler pair, so disabling stays correct.
    <ScrollMenu RTL LeftArrow={RightArrow} RightArrow={LeftArrow}>
      {items.map(({ id }) => (
        <Card itemId={id} key={id} title={id} />
      ))}
    </ScrollMenu>
  );
}

Common Mistakes

CRITICAL Transition props ignored under default noPolyfill

Wrong:

tsx
<ScrollMenu transitionDuration={1200}>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

Correct:

tsx
<ScrollMenu noPolyfill={false} transitionDuration={1200}>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

noPolyfill defaults to true (native scrollIntoView) since v8.0.0, so duration, boundary and custom-function behavior are silently discarded unless noPolyfill={false} pulls in the smooth-scroll polyfill. (Shared with menu-migration: code written for v5–v7 relied on the polyfill being the default.)

Source: src/helpers.tsx:72-77; src/index.tsx:183; CHANGELOG v8.0.0

HIGH Custom transitionBehavior function without noPolyfill={false}

Wrong:

tsx
<ScrollMenu transitionBehavior={transition as unknown as ScrollBehavior}>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

Correct:

tsx
<ScrollMenu
  noPolyfill={false}
  transitionBehavior={transition as unknown as ScrollBehavior}
>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

With noPolyfill true the function is cast to a native ScrollBehavior string and handed to scrollIntoView, which ignores or rejects it — custom easing only works through the polyfill.

Source: src/helpers.tsx:67; stories/CustomTransition/CustomTransition.source.tsx

HIGH Combining transition props with RTL

Wrong:

tsx
<ScrollMenu RTL noPolyfill={false} transitionDuration={800}>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

Correct:

tsx
<ScrollMenu RTL LeftArrow={RightArrow} RightArrow={LeftArrow}>
  {items.map(({ id }) => (
    <Card itemId={id} key={id} title={id} />
  ))}
</ScrollMenu>

The polyfill has RTL bugs (page-level horizontal scrolling); transitions and the RTL prop are documented as not combining — RTL menus keep the noPolyfill default and native scrolling.

Source: README.md "Transitions and animation"; https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu/issues/230 (#241, #216)

MEDIUM behavior field in ScrollOptions treated as effective

Wrong:

tsx
api.scrollToItem(api.getItemById('item-3'), undefined, 'center', 'nearest', {
  behavior: 'smooth', // never reaches the scroll call
});

Correct:

tsx
api.scrollToItem(api.getItemById('item-3'), 'smooth', 'center', 'nearest', {
  behavior: 'smooth', // required by the type, but only satisfies TS
  duration: 800, // duration/boundary are the fields that take effect
});

scrollToItemOptions types behavior as required, but the implementation spreads the positional behavior after the options object, so options.behavior is always overridden (falling back through transitionBehavior to 'smooth') — only duration and boundary in the options object matter, and only in polyfill mode.

Source: src/types.ts:55-59 vs src/helpers.tsx:66-77; src/createApi.ts:316-336

Tensions

HIGH Tension: native scroll correctness vs animation control

noPolyfill={true} (the default) avoids the polyfill's elusive edge bugs but makes every transition prop a no-op; noPolyfill={false} restores animation control (duration, easing, per-call ScrollOptions) and re-imports those bugs — RTL breakage and page-level scrolling. Agents adding transitionDuration for polish silently get nothing; agents flipping noPolyfill for animation break RTL menus. Pick one side per menu: animated LTR with noPolyfill={false}, or RTL/maximum-correctness with the default. The scroll methods these props modify are covered in menu-scrolling.

See also

  • menu-scrolling — scrollToItem, scrollNext/scrollPrev, apiRef, and paging: transition props and ScrollOptions modify how those scroll methods animate.

Foire aux questions

À quoi sert la compétence IA Menu Transitions Rtl ?

Animez le défilement de react-horizontal-scrolling-menu et créez des menus de droite à gauche : noPolyfill vaut true par défaut depuis la v8. Par conséquent, transitionDuration (500 par défaut), un transitionBehavior avec une fonction d’accélération personnalisée et les ScrollOptions { duration, boundary } définies pour chaque appel à scrollToItem/scrollNext/scrollPrev sont ignorées silencieusement, sauf si noPolyfill={false} (les comportements sous forme de chaînes 'smooth' | 'auto' sont toujours transmis à scrollIntoView natif). La prop RTL (qui ajoute uniquement une classe CSS direction:...

Pourquoi utiliser Menu Transitions Rtl sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Menu Transitions Rtl se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Menu Transitions Rtl dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu/tree/master/skills/menu-transitions-rtl. TypingMind lit le fichier SKILL.md et l’installe sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Menu Transitions Rtl ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Menu Transitions Rtl ?

Autant que vous le souhaitez. Vous pouvez utiliser Menu Transitions Rtl avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Menu Transitions Rtl est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par asmyshlyaev177 sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇