St-annotated-text not accepting width command

Hi,

I’m trying to use st-annotated-text within my streamlit project, and whilst I can get it to accept, colour and annotate my data the data is long and goes off of the edge of the screen.

Looking at examples and documentation it looks as though I should be able to use the format

annotated_text(*data, width=200)

however when I do that I get the following error:

TypeError: annotated_text() got an unexpected keyword argument 'width'

Any ideas what on what I can do as the current view is unusable for me.

Thanks!

Hi @neilc,

Thanks for posting!

Can you point us towards the docs that use the width keyword with this component?

st-annotated-text accepts the following inputs:

  • strings, to draw the string as-is on the screen.
  • tuples of the form (main_text, annotation_text, background, color) where background and foreground colors are optional and should be an CSS-valid string such as “#aabbcc” or “rgb(10, 20, 30)”
  • htbuilder.HtmlElement objects in case you want to customize the annotations further. In particular, you can import the annotation() function from this module to easily produce annotations whose CSS you can customize via keyword arguments.

To customize the width, it looks like you would use htbuilder.HtmlElement

Caroline :balloon:

Thanks @Caroline. My mistake, you are correct. I have got it to work now. Thanks for pointing me in the right direction!

1 Like