In ubiquitous computing, user needs may opportunistically emerge along the variation of the context of use. Thus, there is a need for dynamically composing interactive systems. An interactive system is made of a functional core and a User Interface (UI). This work deals with the composition of UIs to support opportunistic user needs in a given context of use (user, platform, environment). It proposes a problem space of UI composition based on a social study. A state of the art shows the originality of the work: the composition of the task model. The composition of the concrete UI is delegated to a toolkit of interactors defined at the task level. The composition of the task model is done by automated planning. The work shows that current planners do not fulfill Human Computer Interaction (HCI) requirements. Therefore, a specific planner has been developed to compose UIs. This planner is used in Compose, our proof of concept. The work is original in two points: first, by the high level of abstraction the composition is performed at; secondly, by the use of automated planning in HCI.