Skip to content

Attributes & props

One source of truth for the container attributes the headless core reads and the props/events the framework wrappers expose. They all map onto the same underlying behaviour.

[data-turing] container (core)

Read by @cluion/turing-core on mount. The Laravel <x-turing> component and the Web Component emit these for you.

AttributeRequiredDescription
data-turingyesMarks the mount container.
data-turing-urlyesChallenge endpoint URL.
data-turing-typenoChallenge type, e.g. pow. Omit for the server default.
data-turing-fieldnoHidden input name. Default turing_token.
data-turing-autostartnoPoW only: solve immediately (no checkbox). Default is interactive UI.
data-turing-no-workernoPoW only: force main-thread solve. Workers are on by default.

Labels (PoW copy)

AttributeDefaultWhen shown
data-turing-labelShorthand for idle only.
data-turing-label-idleI'm not a robotCheckbox waiting (wins over shorthand).
data-turing-label-loadingLoading…Fetching the challenge.
data-turing-label-solvingVerifying…PoW running.
data-turing-label-solvedVerifiedSuccess.
data-turing-label-errorVerification failed — try againFailure.
data-turing-label-ariaVerify you are humanCheckbox aria-label.
data-turing-label-refreshRefreshMath/text refresh button.
data-turing-no-refreshHide the math/text refresh control.

State is reflected on data-turing-state:

StateMeaning
loadingFetching the challenge.
idlePoW checkbox shown; waiting for the user.
solvingPoW in progress.
solvedToken injected (PoW done, or image answer typed).
readyImage challenge ready for user input.
errorFetch/solve failed.

<turing-captcha> element & <Turing> wrappers

Prop / attributeRequiredMaps to
urlyesdata-turing-url
typenodata-turing-type
fieldnodata-turing-field
autostartnodata-turing-autostart
no-worker / noWorkernodata-turing-no-worker
labelnodata-turing-label (idle shorthand)
label-idle / labelIdlenodata-turing-label-idle
label-loading / labelLoadingnodata-turing-label-loading
label-solving / labelSolvingnodata-turing-label-solving
label-solved / labelSolvednodata-turing-label-solved
label-error / labelErrornodata-turing-label-error
label-aria / labelArianodata-turing-label-aria

Outcomes surface as events (Web Component / Vue) or callback props (React):

Web Component / VueReactWhen
turing:solvedonSolvedToken injected into the form.
turing:erroronErrorFetch/solve/validation failed (carries the error).
turing:readyonReadyImage challenge painted (math/text).

All wrappers render in light DOM so the injected hidden input stays inside the enclosing <form> and submits normally.

Laravel <x-turing>

blade
{{-- English defaults --}}
<x-turing type="pow" />

{{-- Chinese copy --}}
<x-turing
  type="pow"
  label="我不是機器人"
  label-solving="驗證中…"
  label-solved="已通過"
  label-error="驗證失敗,請再試一次"
/>

{{-- Auto-solve, no checkbox --}}
<x-turing type="pow" autostart />
PropMaps to
type / field / urlsame as above
autostartdata-turing-autostart
noWorker (no-worker)data-turing-no-worker
labeldata-turing-label
labelIdle / labelLoading / labelSolving / labelSolved / labelError / labelAriamatching data-turing-label-*

Vue / React

vue
<Turing
  url="/turing/challenge"
  type="pow"
  label="我不是機器人"
  label-solving="驗證中…"
  label-solved="已通過"
  @solved="onSolved"
/>
jsx
<Turing
  url="/turing/challenge"
  type="pow"
  label="我不是機器人"
  labelSolving="驗證中…"
  labelSolved="已通過"
  onSolved={onSolved}
/>