Skip to content

feat: support for AttributedString objects#14402

Draft
m1ga wants to merge 1 commit intomainfrom
attributedString
Draft

feat: support for AttributedString objects#14402
m1ga wants to merge 1 commit intomainfrom
attributedString

Conversation

@m1ga
Copy link
Contributor

@m1ga m1ga commented Mar 13, 2026

fixes #14401

Allows to use attributedString with a json object instead of creating an attributedString object first.

var win = Ti.UI.createWindow();
var text = "just some text in Titanium SDK";
var as = {
  text: text,
	attributes: [{
		range: [text.indexOf('some'), ('some').length],
		type: Ti.UI.ATTRIBUTE_FONT,
		value: {
			fontFamily: 'arial',
			fontSize: 12
		}
	}, {
    type: Ti.UI.ATTRIBUTE_BACKGROUND_COLOR,
		value: "red",
		range: [text.indexOf('Titanium'), ('Titanium').length]
	}]
};
var lbl = Ti.UI.createLabel({
	attributedString: as,
});
win.add(lbl);
win.open()

Code by @grebulon 👍

⚠️ Draft request: iOS version and docs will follow tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: support raw (non-proxy) attributed strings in labels

1 participant