Setting Custom CSS Class in Rule
  • 24 Jan 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Setting Custom CSS Class in Rule

  • Dark
    Light

Article summary

You can add custom CSS classes to components in execution point postDialogOut. In this particular example, we style the color, font size and size of a button.

public class PostDialogOut extends AbstractRule {

	@Override
	public boolean execute(String point) {
		RendererModel rendererModel = getRendererModel(point);
		styleButton(rendererModel);
		return true;
	}

	private void styleButton(RendererModel rendererModel) {
		Action button = rendererModel.getAction("212431");
		((ButtonHTML)button.getParent()).setCustomCssClass(ComponentCustomCss.COMPONENT, "large_button");
	}
	
}

In previous versions of Comflow, this styling could look like this.

.large_button {
  border: none;
  cursor: pointer;
  text-align: center;
  color: green;
  font-size: 120%;
  margin-top: 10px;
  margin-right: 10px;
  padding: 15px 25px 15px 25px;
  border-radius: 10px;
}

In Comflow 2.24 versions, you must change your styling to this.

.large_button {
  height: 40px; /* You must adjust height according to your needs. */
  border: none;
  cursor: pointer;
  color: green;
  font-size: 120%;
  border-radius: 10px;
}



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.