you can use Sling Parameterized option right -
To pass parameters from HTL (HTML Template Language) to a Sling Model in Adobe Experience Manager (AEM), you can use data attributes in your HTL and retrieve them in the Sling Model using the @ScriptVariable or @RequestAttribute annotations.
HTL script sends parameters to the Sling Model - The model manipulates these parameters in its method and returns the result for display.
<sly data-sly-use.myModel="${'com.example.core.models.ParameterizedModel' @ myParameterOne='Hello', myParameterTwo='World'}"
data-sly-test.isReady="${myModel.isReady()}">
<p>
${myModel.value}
</p>
</sly>
<sly data-sly-use.placeholderTemplate="core/wcm/components/commons/v1/templates.html"
data-sly-call="${placeholderTemplate.placeholder @ isEmpty=!isReady}">
</sly>
https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/developing/advance...