# Attribute Modifier With the attribute modifier, you can dynamically set component attributes, complete with the **if/else** syntax and polymorphic style. > **NOTE** > > This feature is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version. > > Ensure that the attributes set in **attributeModifier** are different from those set in other methods. Otherwise, **attributeModifier** does not take effect when the page is refreshed. ## attributeModifier attributeModifier(modifier: AttributeModifier\) Creates an attribute modifier. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ------------------------------------------------------------ | | modifier | [AttributeModifier\](#attributemodifiert) | Yes | Modifier for dynamically setting attributes on the current component. The **if/else** syntax is supported.
**modifier**: attribute modifier. You need a custom class to implement the **AttributeModifier** API.| ## AttributeModifier\ You need a custom class to implement the **AttributeModifier** API. **Atomic service API**: This API can be used in atomic services since API version 12. ### applyNormalAttribute applyNormalAttribute(instance: T) : void Applies the style of a component in the normal state. **Atomic service API**: This API can be used in atomic services since API version 12. ### applyPressedAttribute applyPressedAttribute(instance: T) : void Applies the style of a component in the pressed state. **Atomic service API**: This API can be used in atomic services since API version 12. ### applyFocusedAttribute applyFocusedAttribute(instance: T) : void Applies the style of a component in the focused state. **Atomic service API**: This API can be used in atomic services since API version 12. ### applyDisabledAttribute applyDisabledAttribute(instance: T) : void Applies the style of a component in the disabled state. **Atomic service API**: This API can be used in atomic services since API version 12. ### applySelectedAttribute applySelectedAttribute(instance: T) : void Applies the style of a component in the selected state. In the preceding APIs, **instance** indicates the component type. You can customize these APIs and use them with the **if/else **syntax. **Atomic service API**: This API can be used in atomic services since API version 12. **Parameters** | Name | Description | | -------------------- | ------------------------------------------------------------ | | instance |Component attribute class, which identifies the type of component to which attributes will be applied, for example, **ButtonAttribute** for the **\