Logo de Menu Transitions Rtl

Menu Transitions Rtl

Comunidade
asmyshlyaev177
menu-transitions-rtl

Anime a rolagem de react-horizontal-scrolling-menu e crie menus da direita para a esquerda: desde a v8, noPolyfill tem true como padrão. Por isso, transitionDuration (padrão 500), transitionBehavior com função de easing personalizada e ScrollOptions { duration, boundary } em cada chamada de scrollToItem/scrollNext/scrollPrev são ignorados silenciosamente, a menos que noPolyfill={false} (os comportamentos de string 'smooth' | 'auto' ainda são encaminhados para scrollIntoView nativo). A prop RTL (apenas uma classe CSS direction: rtl) tem limitações — nunca a combine com props de transição. Use quando a velocidade ou o easing da animação de rolagem não surtir efeito, para personalizar transições ou criar menus RTL.

Add to TypingMind

Visão geral

Publicado porasmyshlyaev177
Repositórioreact-horizontal-scrolling-menu
Nome da habilidademenu-transitions-rtl
Estrelas
790
Forks
101
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por asmyshlyaev177 no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Menu Transitions Rtl no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu/tree/master/skills/menu-transitions-rtl
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Menu Transitions Rtl em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Menu Transitions Rtl automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Menu Transitions Rtl não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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.

Perguntas frequentes

O que a habilidade de IA Menu Transitions Rtl faz?

Anime a rolagem de react-horizontal-scrolling-menu e crie menus da direita para a esquerda: desde a v8, noPolyfill tem true como padrão. Por isso, transitionDuration (padrão 500), transitionBehavior com função de easing personalizada e ScrollOptions { duration, boundary } em cada chamada de scrollToItem/scrollNext/scrollPrev são ignorados silenciosamente, a menos que noPolyfill={false} (os comportamentos de string 'smooth' | 'auto' ainda são encaminhados para scrollIntoView nativo). A prop RTL (apenas uma classe CSS direction: rtl) tem limitações — nunca a combine com props de transição. Us...

Por que usar Menu Transitions Rtl no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Menu Transitions Rtl é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Menu Transitions Rtl no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/asmyshlyaev177/react-horizontal-scrolling-menu/tree/master/skills/menu-transitions-rtl. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Menu Transitions Rtl?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Menu Transitions Rtl?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Menu Transitions Rtl com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Menu Transitions Rtl é gratuita?

Sim. A habilidade é publicada no GitHub por asmyshlyaev177 sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇